This strategy uses two stochastic oscillators with different parameters to determine bull/bear conditions. It is a typical moving average crossover system. The faster oscillator judges short-term trends and entry signals, while the slower one confirms overall trend direction. Signals are generated from the combination.
Fast %K shows short-term trend direction. %K crossing over the smoothing line SM1 generates entry signals.
Slow %K reflects overall trend conditions. When fast oscillator gives reversal signal, check slow oscillator for trend validity.
%K fast crossover above SM1 indicates bullish signal. Slow %K above 50 means uptrend, satisfying long condition.
%K fast crossover below SM1 indicates bearish signal. Slow %K below 50 means downtrend, satisfying short condition.
Set take profit and stop loss points at fixed percentages.
Dual stochastic filters noise and improves accuracy. Fast and slow combination reduces being trapped risks.
Smaller SM1 parameter makes %K sensitive for catching short-term opportunities.
Larger cycle judges overall trend, smaller cycle captures reversals. Dual long/short strategies fit most market environments.
Fixed profit taking and stop loss points make risk controllable without huge swings.
Divergence between indicators can cause missed trades or wrong signals.
Fixed profit taking and stop loss points lack flexibility in adjusting to markets.
Stochastic parameters need repetitive optimization, improper settings lead to failure.
High trading frequency from short-term trading increases transaction costs.
Add other indicators or filters to ensure signal quality.
Test different parameter combinations to find optimal settings.
Incorporate volatility measures to make profit taking and stop loss levels dynamic.
Use time filters to avoid key events and irrational price swings.
Optimize capital management strategies like position sizing to improve capital efficiency.
This strategy integrates fast and slow stochastic oscillators into a dual directional system. Further parameter optimization and adding filters like trend and volatility indicators can improve it. With proper risk control, this strategy can achieve relatively steady excess returns.
/*backtest start: 2023-08-17 00:00:00 end: 2023-09-16 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy("Double Stochastic", overlay=true) //-----------------------Stochastics------------------------// c= security(syminfo.tickerid,timeframe.period , close) h= security(syminfo.tickerid, timeframe.period, high) l= security(syminfo.tickerid, timeframe.period, low) c1= security(syminfo.tickerid, timeframe.period, close) h2= security(syminfo.tickerid, timeframe.period, high) l1= security(syminfo.tickerid, timeframe.period, low) K1 = input(5, title="K", minval=1, title="Leading K") SM1 = input(2, title="Smooth", minval=1, title="Leading Smooth ") k = ema(stoch(c, h, l, K1), SM1) K2 = input(97, title="K", minval=1, title="Lagging K") D2 = input(3, title="D", minval=1, title="Lagging D") SM2 = input(1, title="Smooth", minval=1, title="Lagging Smooth") k1 = ema(stoch(c1, h2, l1, K2), SM2) // buy ((k[2] < 40 and k > 40) and bars_up > 0 and k1 > 50) // sell (k[2] > 60 and k < 60) and bars_down > 0 and k1 < 50 //-----------------------Mechanics------------------------// buy = k1 > 50 and k < 30 and k > k[1] ? 1 : 0 sell = k1 < 50 and k > 70 and k < k[1] ? 1 : 0 buy_val = valuewhen(buy == 1, close, 1) sell_val = valuewhen(sell == 1, close, 1) buy_close = buy_val * input(1.20, minval=0.1) sell_close = sell_val / input(1.20, minval=0.1) //------------------------Buy/Sell-------------------------// longCondition = buy == 1 if (longCondition) strategy.entry("My Long Entry Id", strategy.long) close_long = close >= buy_close if (close_long) strategy.close("My Long Entry Id") sellCondition = sell == 1 if (sellCondition) strategy.entry("My Short Entry Id", strategy.short) close_short = close <= sell_close if (close_short) strategy.close("My Short Entry Id")