
이 전략은 여러 이동 평균 (SMA) 과 상대적으로 약한 지표 (RSI) 의 교차 신호를 기반으로 한 자동화 거래 시스템입니다. 단기 및 중기 이동 평균의 여러 검증 메커니즘을 결합하고 RSI 지표를 통해 트렌드 확인을 수행하며 동적 ATR을 사용하여 위험을 제어하여 완전한 거래 의사 결정 프레임 워크를 구축합니다. 이 전략은 주로 시장 트렌드 전환점을 포착하여 여러 기술 지표의 교차 확인을 통해 거래의 정확성을 향상시킵니다.
이 전략의 핵심 논리는 다섯 가지 핵심 조건의 통합된 판단에 기초하고 있습니다.
이 다섯 가지 조건이 동시에 충족될 때만, 전략은 구매 신호를 생성한다. 입문 후, 전략은 ATR 기반의 동적 중지 및 중지 수준을 사용한다. 그 중 중단은 1.5 배의 ATR로 설정되고, 중단은 2.5 배의 ATR로 설정되며, 이러한 디자인은 시장의 변동성에 따라 자동으로 위험 관리 매개 변수를 조정할 수 있다.
이것은 합리적인 기술 거래 전략을 설계하여 여러 기술 지표의 교차 확인을 통해 거래의 정확성을 높이고, 다이내믹 리스크 관리 시스템을 사용하여 수익을 보호합니다. 전략에는 일정 한계가 있지만, 권장된 최적화 방향에 의해 그 성능을 더욱 향상시킬 수 있습니다. 이 전략은 위험 감수성이 강한 장기적인 전략 최적화를 수행하려는 거래자에게 적합합니다.
/*backtest
start: 2024-02-22 00:00:00
end: 2025-02-19 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
//@version=5
strategy("Virat Bharat Auto Trade", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// **User-Defined Inputs for Customization**
smaLength20 = input(20, title="SMA High/Low 20 Length")
smaLength50 = input(50, title="SMA High/Low 50 Length")
rsiLength = input(7, title="RSI Length")
rsiLevel = input(50, title="RSI Crossover Level")
atrMultiplierSL = input(1.5, title="ATR Multiplier for Stop Loss")
atrMultiplierTP = input(2.5, title="ATR Multiplier for Target")
// **Defining the Indicators with Custom Inputs**
smaHigh20 = ta.sma(high, smaLength20)
smaLow20 = ta.sma(low, smaLength20)
smaHigh50 = ta.sma(high, smaLength50)
smaLow50 = ta.sma(low, smaLength50)
rsiValue = ta.rsi(close, rsiLength)
atrValue = ta.atr(14) // ATR for Dynamic Stop Loss & Target
// **Conditions for Buy Signal**
condition1 = ta.crossover(close, smaHigh20)
condition2 = ta.crossover(close, smaLow20)
condition3 = ta.crossover(close, smaHigh50)
condition4 = ta.crossover(close, smaLow50)
condition5 = ta.crossover(rsiValue, rsiLevel)
// **Final Buy Signal (Only when all conditions match)**
buySignal = condition1 and condition2 and condition3 and condition4 and condition5
// **Buy Price, Stop Loss & Target**
buyPrice = close
stopLoss = buyPrice - (atrValue * atrMultiplierSL) // Dynamic Stop Loss
target = buyPrice + (atrValue * atrMultiplierTP) // Dynamic Target
// **Plot Buy Signal on Chart**
plotshape(buySignal, location=location.belowbar, color=color.green, style=shape.labelup, title="BUY", size=size.small, text="BUY")
// **Plot Labels for Buy, Stop Loss & Target**
if buySignal
label.new(x=bar_index, y=buyPrice, text="BUY @ " + str.tostring(buyPrice, format="#.##"), color=color.green, textcolor=color.white, size=size.small, style=label.style_label_down, yloc=yloc.price)
label.new(x=bar_index, y=stopLoss, text="STOP LOSS @ " + str.tostring(stopLoss, format="#.##"), color=color.red, textcolor=color.white, size=size.small, style=label.style_label_down, yloc=yloc.price)
label.new(x=bar_index, y=target, text="TARGET @ " + str.tostring(target, format="#.##"), color=color.blue, textcolor=color.white, size=size.small, style=label.style_label_up, yloc=yloc.price)
// **Strategy Trading Logic - Automated Entry & Exit**
if buySignal
strategy.entry("BUY", strategy.long)
strategy.exit("SELL", from_entry="BUY", loss=atrValue * atrMultiplierSL, profit=atrValue * atrMultiplierTP)