
この戦略は,複数の移動平均 ((SMA)) と比較的強い指標 ((RSI)) の交差信号に基づく自動取引システムである.それは,短期と中期移動平均の複数の検証機構を組み合わせ,RSI指標を介してトレンド確認を行い,ダイナミックATRのストップを活用してリスクを制御し,完全な取引意思決定の枠組みを構築する.この戦略は,主に市場トレンドの転換点を捕捉し,複数の技術指標の交差確認によって取引の正確性を向上させるために使用される.
戦略の核心的な論理は,以下の5つの重要な条件の総合的な判断に基づいています.
この5つの条件が同時に満たされた場合にのみ,戦略は買取シグナルを生成する.入場後,戦略は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)