
Strategi ini adalah strategi pengesanan trend berdasarkan isyarat oversold RSI, trend garis rata-rata jangka pendek dan pengesahan jumlah transaksi. Ia terutamanya membina kedudukan berbilang dengan mengenal pasti peluang oversold jangka pendek dalam trend kenaikan jangka panjang, sambil menggunakan pembesaran transaksi untuk mengesahkan keberkesanan isyarat perdagangan.
Logik utama strategi ini adalah berdasarkan kepada tiga syarat utama iaitu:
Apabila ketiga-tiga syarat di atas dipenuhi secara bersamaan, strategi memasuki kedudukan berbilang mata. Isyarat kedudukan kosong dipicu oleh garis rata-rata jangka pendek di bawah garis rata-rata jangka panjang ((dead fork)). Pada masa yang sama, strategi menetapkan 5% stop loss untuk mengawal risiko.
Ini adalah strategi trend-following yang dirancang dengan logik dan logik yang ketat, dengan penggunaan gabungan pelbagai petunjuk teknikal, menyeimbangkan keuntungan dan risiko dengan berkesan. Kelebihan utama strategi ini adalah mekanisme pengesahan isyarat yang baik dan sistem kawalan risiko, tetapi juga menghadapi cabaran seperti kelebihan dan ketinggalan. Dengan arah pengoptimuman yang disyorkan, strategi ini dijangka dapat mencapai prestasi yang lebih baik dalam aplikasi sebenar.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © wielkieef
//@version=5
strategy(title=' Rsi Long-Term Strategy [15min]', overlay=true, pyramiding=1, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, calc_on_order_fills=false, slippage=0, commission_type=strategy.commission.percent, commission_value=0.03)
// Rsi
rsi_lenght = input.int(10, title='RSI lenght', minval=0)
rsi_up = ta.rma(math.max(ta.change(close), 0), rsi_lenght)
rsi_down = ta.rma(-math.min(ta.change(close), 0), rsi_lenght)
rsi_value = rsi_down == 0 ? 100 : rsi_up == 0 ? 0 : 100 - 100 / (1 + rsi_up / rsi_down)
rsi_overs = rsi_value <= 30
rsi_overb = rsi_value >= 70
// Volume
vol_sma_length = input.int(20, title='Volume lenght ', minval=1)
Volume_condt = volume > ta.sma(volume, vol_sma_length) * 2.5
//SMA1
lengthSMA1 = input(250, title="Lenght SMA 1")
SMA1 = ta.sma(close, lengthSMA1)
//plot(SMA1, color=color.rgb(245, 108, 3), linewidth=1, title="SMA250")
//SMA2
lengthSMA2 = input(500, title="Lenght SMA 2")
SMA2 = ta.sma(close, lengthSMA2)
//plot(SMA2, color=#9803f5, linewidth=1, title="SMA500")
//Entry Logic
Long_cond = (rsi_overs and SMA1 > SMA2 and Volume_condt )
if Long_cond
strategy.entry('Long', strategy.long)
//Close Logic
Long_close = ta.crossunder(SMA1,SMA2)
if Long_close
strategy.close("Long")
//Bar colors
Bar_color = Volume_condt ? #fc9802 : SMA1 > SMA2 ? color.rgb(84, 252, 0) : SMA1 < SMA2 ? color.maroon : color.gray
barcolor(color=Bar_color)
// Rsi value Plotshapes
plotshape(rsi_value < 30 and SMA1 > SMA2 and Volume_condt, title='Buy', color=color.new(color.green, 0), style=shape.circle, location=location.belowbar, size=size.tiny, textcolor=color.new(color.black, 0))
plotshape(rsi_value > 70 and SMA1 < SMA2 and Volume_condt, title='Sell', color=color.new(color.red, 0), style=shape.circle, location=location.abovebar, size=size.tiny, textcolor=color.new(color.black, 0))
plotshape(ta.crossunder(SMA1,SMA2) , title='DEATH CROSS', color=#000000, style=shape.xcross, location=location.abovebar, size=size.small, textcolor=color.new(color.black, 0))
//Stop-Loss// this code is from author RafaelZioni, modified by wielkieef
pera(pcnt) =>
strategy.position_size != 0 ? math.round(pcnt / 100 * strategy.position_avg_price / syminfo.mintick) : float(na)
stoploss = input.float(title=' stop loss', defval=5.0, minval=0.5)
los = pera(stoploss)
strategy.exit('SL', loss=los)
// by wielkieef