
La stratégie utilise un croisement entre une moyenne mobile rapide (EMA) et une moyenne mobile lente (EMA), combinée à un indice relativement faible (RSI) et à une rupture de ligne de tendance pour capturer des opportunités de trading tendance. La stratégie génère un signal multiple lorsque l’EMA rapide traverse une EMA lente ou une rupture de ligne de tendance et que le RSI est inférieur au niveau de survente.
Cette stratégie, combinée à l’EMA, au RSI et à la rupture de la ligne de tendance, permet de capturer plus efficacement les opportunités de trading tendance. Cependant, elle comporte également certains risques, tels que les faux signaux et la dépendance aux données historiques. Par conséquent, dans la pratique, il est nécessaire d’optimiser et d’améliorer de manière appropriée en fonction des caractéristiques du marché et des préférences de risque individuelles, telles que l’introduction de plus d’indicateurs, la définition d’un stop-loss dynamique et des paramètres d’optimisation.
/*backtest
start: 2023-05-22 00:00:00
end: 2024-05-27 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Gold Trading Strategy 15 min", overlay=true)
// Input parameters
fast_ma_length = input.int(10, title="Fast MA Length")
slow_ma_length = input.int(30, title="Slow MA Length")
rsi_length = input.int(14, title="RSI Length")
rsi_overbought = input.int(70, title="RSI Overbought Level")
rsi_oversold = input.int(30, title="RSI Oversold Level")
lookback = input.int(50, title="Trendline Lookback Period")
// Indicators
fast_ma = ta.sma(close, fast_ma_length)
slow_ma = ta.sma(close, slow_ma_length)
rsi = ta.rsi(close, rsi_length)
// Trendline breakout detection
highs = ta.highest(high, lookback)
lows = ta.lowest(low, lookback)
trendline_breakout_up = ta.crossover(close, highs)
trendline_breakout_down = ta.crossunder(close, lows)
// Entry conditions
udao_condition = (ta.crossover(fast_ma, slow_ma) or trendline_breakout_up) and rsi < rsi_overbought
girao_condition = (ta.crossunder(fast_ma, slow_ma) or trendline_breakout_down) and rsi > rsi_oversold
// Strategy execution
if (udao_condition)
strategy.entry("उदाओ", strategy.long)
if (girao_condition)
strategy.entry("गिराओ", strategy.short)
// Plotting
plot(fast_ma, color=color.blue, title="Fast MA")
plot(slow_ma, color=color.red, title="Slow MA")
hline(rsi_overbought, "RSI Overbought", color=color.red)
hline(rsi_oversold, "RSI Oversold", color=color.green)
plot(rsi, color=color.purple, title="RSI")
plotshape(series=udao_condition, location=location.belowbar, color=color.green, style=shape.labelup, title="उदाओ Signal")
plotshape(series=girao_condition, location=location.abovebar, color=color.red, style=shape.labeldown, title="गिराओ Signal")
// Plot trendline breakout levels
plot(highs, color=color.orange, linewidth=2, title="Resistance Trendline")
plot(lows, color=color.yellow, linewidth=2, title="Support Trendline")