
La stratégie est un système de trading intégré qui combine des moyennes mobiles à plusieurs périodes, des signaux RSI de survente et de survente, ainsi que l’identification des modèles de prix. La stratégie consiste principalement à déterminer les zones de survente et de survente de l’indicateur RSI en croisant les moyennes mobiles rapides et lentes, ainsi que les modèles de hausse et de baisse.
La logique centrale de la stratégie repose sur les éléments clés suivants:
Il s’agit d’une stratégie de négociation d’analyse technique intégrée conçue de manière rationnelle et logique. En combinant plusieurs indicateurs techniques et formes de prix, la stratégie garantit la fiabilité du signal tout en offrant une meilleure maîtrise des risques. Bien qu’il existe des limitations inhérentes, la performance globale de la stratégie est susceptible d’être encore améliorée par l’orientation de l’optimisation recommandée.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-04 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Comprehensive Trading Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Input parameters for moving averages
fastLength = input.int(9, title="Fast MA Length")
slowLength = input.int(21, title="Slow MA Length")
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
// Calculate moving averages
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
// Calculate RSI
rsi = ta.rsi(close, rsiLength)
// Detect price action patterns (e.g., engulfing patterns)
isBullishEngulfing = close > open and close[1] < open[1] and open < close[1] and close > open[1]
isBearishEngulfing = close < open and close[1] > open[1] and open > close[1] and close < open[1]
// Define conditions for buying and selling
buyCondition = ta.crossover(fastMA, slowMA) and rsi < rsiOversold or isBullishEngulfing
sellCondition = ta.crossunder(fastMA, slowMA) and rsi > rsiOverbought or isBearishEngulfing
// Execute buy and sell orders
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.entry("Sell", strategy.short)
// Plotting
plot(fastMA, color=color.blue, linewidth=2, title="Fast MA")
plot(slowMA, color=color.orange, linewidth=2, title="Slow MA")
hline(rsiOverbought, "RSI Overbought", color=color.red)
hline(rsiOversold, "RSI Oversold", color=color.green)
plot(rsi, color=color.purple, linewidth=1, title="RSI")
// Alert conditions
alertcondition(buyCondition, title="Buy Signal", message="Price meets buy criteria")
alertcondition(sellCondition, title="Sell Signal", message="Price meets sell criteria")
// Plot signals on chart
plotshape(series=buyCondition ? low : na, location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small, title="Buy Signal")
plotshape(series=sellCondition ? high : na, location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small, title="Sell Signal")