This strategy is a dual timeframe momentum trading system based on the Stochastic indicator. It identifies potential trading opportunities by analyzing Stochastic crossover signals across different timeframes, combining momentum principles and trend-following methods for more accurate market trend judgment and trade timing. The strategy also incorporates risk management mechanisms, including take-profit and stop-loss settings, for better money management.
The core logic is based on the following key elements:
This is a well-structured trading strategy with clear logic, capturing market opportunities through dual timeframe Stochastic indicator analysis. The strategy’s strengths lie in its multiple confirmation mechanisms and comprehensive risk control, but attention must be paid to risks such as false breakouts and parameter sensitivity. Through continuous optimization and improvement, the strategy has the potential to achieve better trading results.
/*backtest start: 2024-12-04 00:00:00 end: 2024-12-11 00:00:00 period: 5m basePeriod: 5m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Enhanced Stochastic Strategy", overlay=true) // Input untuk Stochastic length = input.int(14, title="Length", minval=1) OverBought = input(80, title="Overbought Level") OverSold = input(20, title="Oversold Level") smoothK = input.int(3, title="Smooth %K") smoothD = input.int(3, title="Smooth %D") // Input untuk Manajemen Risiko tpPerc = input.float(2.0, title="Take Profit (%)", step=0.1) slPerc = input.float(1.0, title="Stop Loss (%)", step=0.1) // Hitung Stochastic k = ta.sma(ta.stoch(close, high, low, length), smoothK) d = ta.sma(k, smoothD) // Logika Sinyal co = ta.crossover(k, d) // %K memotong %D ke atas cu = ta.crossunder(k, d) // %K memotong %D ke bawah longCondition = co and k < OverSold shortCondition = cu and k > OverBought // Harga untuk TP dan SL var float longTP = na var float longSL = na var float shortTP = na var float shortSL = na if (longCondition) longTP := close * (1 + tpPerc / 100) longSL := close * (1 - slPerc / 100) strategy.entry("Buy", strategy.long, comment="StochLE") strategy.exit("Sell Exit", "Buy", limit=longTP, stop=longSL) if (shortCondition) shortTP := close * (1 - tpPerc / 100) shortSL := close * (1 + slPerc / 100) strategy.entry("Sell", strategy.short, comment="StochSE") strategy.exit("Buy Exit", "Sell", limit=shortTP, stop=shortSL) // Plot Stochastic dan Level hline(OverBought, "Overbought", color=color.red, linestyle=hline.style_dotted) hline(OverSold, "Oversold", color=color.green, linestyle=hline.style_dotted) hline(50, "Midline", color=color.gray, linestyle=hline.style_dotted) plot(k, color=color.blue, title="%K") plot(d, color=color.orange, title="%D") // Tambahkan sinyal visual plotshape(longCondition, title="Buy Signal", location=location.belowbar, style=shape.labelup, color=color.new(color.green, 0), text="BUY") plotshape(shortCondition, title="Sell Signal", location=location.abovebar, style=shape.labeldown, color=color.new(color.red, 0), text="SELL")