
이 전략은 RSI 과매매 신호, 장기 단기 평균선 트렌드 및 거래량 확인에 기반한 트렌드 추적 전략이다. 이 전략은 주로 장기 상승 추세에서 단기 과매매 기회를 식별하여 다수 포지션을 구축하며 거래량을 확대하여 거래 신호의 유효성을 확인한다. 이 전략은 10주기 RSI 지표, 250 및 500주기 쌍평선 시스템, 그리고 20주기 거래량 평균선을 핵심 지표 제품군으로 사용합니다.
이 전략의 핵심 논리는 다음과 같은 세 가지 핵심 조건에 기반합니다.
위의 세 가지 조건이 동시에 충족되면, 전략이 다중 상위 포지션에 진입한다. 평소 포지션 신호는 단기 평균선 아래에서 장기 평균선 ((죽은 포크) 을 통과하는 것으로 촉발된다. 동시에, 전략은 5%의 스톱로스를 설정하여 위험을 통제한다.
이것은 합리적이고 논리적으로 엄격한 트렌드 추적 전략을 설계하고, 여러 기술 지표의 조합을 통해 수익과 위험을 효과적으로 균형 잡는다. 전략의 핵심 장점은 완벽한 신호 확인 장치와 위험 제어 시스템이지만, 과잉 과잉과 지연성 등의 과제에 직면하고 있다. 제안된 최적화 방향으로 전략은 실제 응용에서 더 나은 성능을 얻을 수 있다.
/*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