
La stratégie est un système de trading quantitatif combinant un canal gaussien et un indicateur stochastique relativement faible (le RSI stochastique). La stratégie capte les occasions de revirement de tendance du marché en surveillant les croisements des prix avec le canal gaussien et les mouvements du RSI aléatoire. Le canal gaussien est construit à partir d’une moyenne mobile et d’un écart-type, ce qui permet de refléter dynamiquement la gamme de fluctuations du marché, tandis que le RSI aléatoire fournit un signal de confirmation de la dynamique.
La logique fondamentale de la stratégie comprend les éléments clés suivants :
La stratégie, en combinant le suivi des tendances et les indicateurs de dynamique dans l’analyse technique, construit un système de trading quantifié, logiquement complet et contrôlable par les risques. Bien qu’il existe des risques inhérents, la stratégie est susceptible de maintenir une performance stable dans différents environnements de marché grâce à une optimisation et une amélioration continues. La conception modulaire de la stratégie fournit également une bonne base pour les optimisations et les extensions ultérieures.
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"BNB_USDT"}]
*/
//@version=5
strategy("SAJJAD JAMSHIDI Channel with Stochastic RSI Strategy", overlay=true, commission_type=strategy.commission.percent, commission_value=0.1, slippage=0, default_qty_type=strategy.percent_of_equity, default_qty_value=100, process_orders_on_close=true)
// Gaussian Channel Inputs
lengthGC = input.int(20, "Gaussian Channel Length", minval=1)
multiplier = input.float(2.0, "Standard Deviation Multiplier", minval=0.1)
// Calculate Gaussian Channel
basis = ta.ema(close, lengthGC)
deviation = multiplier * ta.stdev(close, lengthGC)
upperChannel = basis + deviation
lowerChannel = basis - deviation
// Plot Gaussian Channel
plot(basis, "Basis", color=color.blue)
plot(upperChannel, "Upper Channel", color=color.green)
plot(lowerChannel, "Lower Channel", color=color.red)
// Stochastic RSI Inputs
rsiLength = input.int(14, "RSI Length", minval=1)
stochLength = input.int(14, "Stochastic Length", minval=1)
smoothK = input.int(3, "Smooth K", minval=1)
smoothD = input.int(3, "Smooth D", minval=1)
// Calculate RSI
rsi = ta.rsi(close, rsiLength)
// Calculate Stochastic RSI
lowestRSI = ta.lowest(rsi, stochLength)
highestRSI = ta.highest(rsi, stochLength)
stochRSI = (rsi - lowestRSI) / (highestRSI - lowestRSI) * 100
k = ta.sma(stochRSI, smoothK)
d = ta.sma(k, smoothD)
// Trading Conditions
stochUp = k > d
priceAboveUpper = ta.crossover(close, upperChannel)
priceBelowUpper = ta.crossunder(close, upperChannel)
strategy.entry("Long", strategy.long, when=priceAboveUpper and stochUp)
strategy.close("Long", when=priceBelowUpper)