
La stratégie est un système de trading intégré basé sur plusieurs indicateurs techniques, combinant des indicateurs de dynamique, des indicateurs de tendance et des indicateurs de volatilité, pour capturer les opportunités de fluctuation à court terme du marché. La stratégie identifie les opportunités de trading grâce à des signaux de croisement MACD, une confirmation de tendance EMA, un filtrage des conditions de survente RSI et de la force de tendance ADX, et utilise un stop-loss dynamique basé sur l’ATR pour gérer le risque.
La logique fondamentale de la stratégie repose sur les éléments clés suivants :
La stratégie utilise plusieurs indicateurs techniques pour construire un système de négociation complet. Bien qu’il y ait un certain retard et des défis d’optimisation des paramètres, la stratégie montre une meilleure adaptabilité et fiabilité grâce à une gestion des risques raisonnable et une optimisation continue. Il est recommandé aux traders de faire un retour d’expérience et une optimisation des paramètres suffisants avant leur utilisation sur le terrain.
/*backtest
start: 2024-02-18 00:00:00
end: 2025-02-16 08:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Optimized Impulse Wave Strategy", overlay=true)
// === INPUT PARAMETERS ===
fast_length = input(12, title="MACD Fast Length")
slow_length = input(26, title="MACD Slow Length")
signal_smoothing = input(9, title="MACD Signal Smoothing")
ema_length = input(200, title="EMA Length")
rsi_length = input(14, title="RSI Length")
adx_length = input(14, title="ADX Length")
adx_smoothing = input(14, title="ADX Smoothing")
atr_length = input(14, title="ATR Length")
risk_reward_ratio = input(2, title="Risk-Reward Ratio")
adx_threshold = input(20, title="ADX Threshold")
// === INDICATORS ===
[macdLine, signalLine, _] = ta.macd(close, fast_length, slow_length, signal_smoothing)
ema = ta.ema(close, ema_length)
rsi = ta.rsi(close, rsi_length)
[dmiPlus, dmiMinus, adx] = ta.dmi(adx_length, adx_smoothing)
// === ENTRY CONDITIONS ===
bullishTrend = ta.crossover(macdLine, signalLine) and close > ema and adx > adx_threshold and rsi > 50
bearishTrend = ta.crossunder(macdLine, signalLine) and close < ema and adx > adx_threshold and rsi < 50
// === STOP-LOSS & TAKE-PROFIT CALCULATION ===
longStopLoss = close - ta.atr(atr_length) * 1.5
longTakeProfit = close + (ta.atr(atr_length) * 1.5 * risk_reward_ratio)
shortStopLoss = close + ta.atr(atr_length) * 1.5
shortTakeProfit = close - (ta.atr(atr_length) * 1.5 * risk_reward_ratio)
// === STRATEGY EXECUTION ===
// Enter Long
if bullishTrend
strategy.entry("Long", strategy.long)
strategy.exit("TakeProfitLong", from_entry="Long", limit=longTakeProfit, stop=longStopLoss)
// Enter Short
if bearishTrend
strategy.entry("Short", strategy.short)
strategy.exit("TakeProfitShort", from_entry="Short", limit=shortTakeProfit, stop=shortStopLoss)
// === PLOTTING ===
plot(ema, title="EMA 200", color=color.blue, linewidth=2)
plotshape(series=bullishTrend, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal")
plotshape(series=bearishTrend, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal")
// === ALERTS ===
alertcondition(bullishTrend, title="Bullish Entry", message="Buy Signal Triggered!")
alertcondition(bearishTrend, title="Bearish Entry", message="Sell Signal Triggered!")
// === DEBUGGING LOG ===
label.new(bar_index, high, "ADX: " + str.tostring(adx), color=color.white, textcolor=color.black)
label.new(bar_index, low, "MACD Cross: " + str.tostring(macdLine), color=color.white, textcolor=color.black)