This strategy is a quantitative trading system based on multiple technical indicators, integrating Exponential Moving Average (EMA), Relative Strength Index (RSI), and Average Directional Index (ADX). The strategy uses EMA crossover signals as the primary entry criteria, combined with RSI for overbought/oversold confirmation and ADX for trend strength assessment, forming a complete trading decision system. The strategy also includes a risk management module that controls stop-loss and take-profit levels through a predefined risk-reward ratio.
The core logic of the strategy is based on the following key components:
This is a well-designed strategy with complete logic incorporating multiple technical indicators. Through the integration of EMA, RSI, and ADX, the strategy demonstrates good performance in trend following and risk control. While there are areas for optimization, the strategy has good practical value and room for expansion. Performance can be further improved through the suggested optimization directions.
/*backtest start: 2019-12-23 08:00:00 end: 2024-11-11 00:00:00 period: 1d basePeriod: 1d exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Enhanced EMA + RSI + ADX Strategy", overlay=true) // Input parameters lenFast = input.int(9, title="Fast EMA Length", minval=1) lenSlow = input.int(21, title="Slow EMA Length", minval=1) rsiPeriod = input.int(14, title="RSI Period") adxPeriod = input.int(14, title="ADX Period") adxSmoothing = input.int(1, title="ADX Smoothing") adxThreshold = input.int(20, title="ADX Threshold") riskRewardRatio = input.float(2.0, title="Risk/Reward Ratio") // EMA Calculations fastEMA = ta.ema(close, lenFast) slowEMA = ta.ema(close, lenSlow) // RSI Calculation rsiValue = ta.rsi(close, rsiPeriod) // ADX Calculation [plusDI, minusDI, adxValue] = ta.dmi(adxPeriod, adxSmoothing) // Entry Conditions buyCondition = ta.crossover(fastEMA, slowEMA) and rsiValue < 60 and adxValue > adxThreshold sellCondition = ta.crossunder(fastEMA, slowEMA) and rsiValue > 40 and adxValue > adxThreshold // Entry logic if (buyCondition) strategy.entry("Buy", strategy.long) strategy.exit("Sell", from_entry="Buy", limit=close + (close - strategy.position_avg_price) * riskRewardRatio, stop=close - (close - strategy.position_avg_price)) if (sellCondition) strategy.close("Buy") // Plotting EMAs (thinner lines) plot(fastEMA, color=color.new(color.green, 0), title="Fast EMA", linewidth=1) plot(slowEMA, color=color.new(color.red, 0), title="Slow EMA", linewidth=1) // Entry and exit markers (larger shapes) plotshape(series=buyCondition, style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), size=size.normal, title="Buy Signal") plotshape(series=sellCondition, style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.normal, title="Sell Signal") // Displaying price labels for buy/sell signals if (buyCondition) label.new(bar_index, low, text="Buy\n" + str.tostring(close), color=color.new(color.green, 0), style=label.style_label_down, textcolor=color.white) if (sellCondition) label.new(bar_index, high, text="Sell\n" + str.tostring(close), color=color.new(color.red, 0), style=label.style_label_up, textcolor=color.white) // Optional: Add alerts for entry signals alertcondition(buyCondition, title="Buy Alert", message="Buy signal triggered") alertcondition(sellCondition, title="Sell Alert", message="Sell signal triggered")