
This strategy is a quantitative trading system that combines the Gaussian Channel and Stochastic RSI indicators. It captures market trend reversal opportunities by monitoring price crossovers with the Gaussian Channel and Stochastic RSI movements. The Gaussian Channel, constructed using moving averages and standard deviations, dynamically reflects market volatility ranges, while the Stochastic RSI provides momentum confirmation signals.
The core logic of the strategy includes the following key components: 1. Gaussian Channel Construction: Uses a 20-period EMA as the channel centerline, with upper and lower boundaries calculated by adding and subtracting 2 times the standard deviation. 2. Stochastic RSI Calculation: First calculates 14-period RSI, then applies a 14-period stochastic formula to the RSI values, finally smoothing the results with a 3-period average to get K and D lines. 3. Trade Signal Generation: Generates long signals when price breaks above the upper Gaussian Channel and Stochastic RSI’s K line crosses above the D line; exits when price falls below the upper channel.
This strategy constructs a logically complete and risk-controlled quantitative trading system by combining trend following and momentum indicators from technical analysis. While there are some inherent risks, through continuous optimization and improvement, the strategy shows promise for maintaining stable performance across different market environments. The modular design also provides a solid foundation for future optimization and expansion.
/*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)