
この戦略は,高速平均線と遅い平均線の交差信号を組み合わせた二重均線システムに基づく動的トレンド追跡戦略であり,入場時間を最適化するためにフィルタリング均線を導入し,資金管理とリスク管理を通じて安定した取引効果を実現する.
戦略は11周期と31周期のSMAを主要なシグナルシステムとして採用し,5周期平均線をフィルターとして使用する. 快線 (SMA11) の上でスローライン (SMA31) を穿過し,価格がフィルター平均線上にあるとき,システムは複数のシグナルを生成する. 快線 (SMA31) の下にスローライン (SMA31) を穿過するときは,システムは平仓する. 戦略は,固定金額を設定して,各取引の規模を制御することで,リスク管理を実現する.
この戦略は,多重均線システムによって比較的安定したトレンド追跡システムを構築している.いくつかの固有の限界があるものの,合理的な最適化と改善によって,戦略の安定性と収益性をさらに向上させることができます.トレーダーは,市場状況と組み合わせて,実際の市場での適用時に,パラメータをターゲットに調整することをお勧めします.
/*backtest
start: 2024-10-01 00:00:00
end: 2024-10-31 23:59:59
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy('Nifty 30m SMA Crossover Long', overlay=true)
start = timestamp(2020, 1, 1, 0, 0)
end = timestamp(2024, 12, 31, 0, 0)
SlowSma = ta.sma(close, 31)
FastSma = ta.sma(close, 11)
FilterSma = ta.sma(close, 5)
plot(SlowSma, title='Sma 31', color=color.new(color.green, 0))
plot(FastSma, title='Sma 11', color=color.new(color.red, 0))
plot(FilterSma, title='Filter Sma 5', color=color.new(color.black, 0))
// strategy
LongEntry = FastSma > SlowSma and close > FilterSma
LongExit = FastSma < SlowSma
MyQty = 10000000 / close
// // Plot signals to chart
// plotshape(not LongExit and strategy.position_size > 0 and bIndicator, title='Hold', location=location.abovebar, color=color.new(color.blue, 0), style=shape.square, text='Hold', textcolor=color.new(color.blue, 0))
// plotshape(LongExit and bIndicator and strategy.position_size > 0, title='Exit', location=location.belowbar, color=color.new(color.red, 0), style=shape.triangledown, text='Sell', textcolor=color.new(color.red, 0))
// plotshape(LongEntry and strategy.position_size == 0 and bIndicator, '', shape.arrowup, location.abovebar, color.new(color.green, 0), text='Buy', textcolor=color.new(color.green, 0))
// plotshape(not LongEntry and strategy.position_size == 0 and bIndicator, '', shape.circle, location.belowbar, color.new(color.yellow, 0), text='Wait', textcolor=color.new(color.black, 0))
if time >= start and time < end
strategy.entry('Enter Long', strategy.long, qty=1, when=LongEntry)
strategy.close('Enter Long', when=LongExit)