
La stratégie est basée sur un système de suivi de tendance dynamique basé sur un système bi-médian, combinant des signaux croisés de médian rapide et de médian lent, tout en introduisant des médianes filtrées pour optimiser le timing d’entrée en jeu et pour obtenir des résultats de trading robustes grâce à la gestion des fonds et à la maîtrise des risques.
La stratégie utilise la moyenne mobile simple à 11 et 31 cycles (SMA) comme système de signaux principal, tout en utilisant la moyenne moyenne à 5 cycles comme filtre. Lorsque la ligne rapide (SMA11) traverse la ligne lente (SMA31) et que le prix est au-dessus de la ligne moyenne filtrée, le système génère plusieurs signaux.
La stratégie a construit un système de suivi de tendance relativement stable grâce à un système de multiples équilibrages. Bien qu’il existe des limites inhérentes, la stabilité et la rentabilité de la stratégie peuvent être encore améliorées par des optimisations et des améliorations raisonnables. Il est recommandé aux traders d’ajuster les paramètres de manière ciblée en fonction des conditions spécifiques du marché lors de leur application en direct.
/*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)