
This strategy combines EMA (Exponential Moving Average) crossovers with RSI (Relative Strength Index) confirmation to identify market trend direction and generate trading signals. The strategy uses a short-term EMA (9-period) and a long-term EMA (21-period) to determine the overall trend direction, while utilizing RSI to confirm trend strength and filter out potential false signals. The core logic is based on directional changes when the short-term moving average crosses the long-term moving average, with RSI serving as an additional confirmation condition, ensuring trades are only executed when trends are clearly established.
The strategy is based on the crossover of two EMAs (9 and 21 periods) combined with RSI readings to assess market conditions. When EMA9 crosses above EMA21 and RSI is above 30, a bullish trend is confirmed, generating a long entry signal. Conversely, when EMA9 crosses below EMA21 and RSI is below 30, a bearish trend is confirmed, generating a short entry signal. The code defines clear trend determination criteria: bullish when EMA9 is greater than EMA21 and RSI is above 30; bearish when EMA9 is less than EMA21 and RSI is below 30. The system enters long positions when long signals appear and enters short positions when short signals appear. Exit conditions are similarly based on EMA crossovers and RSI thresholds: long positions are closed when EMA9 crosses below EMA21 or RSI falls below 30; short positions are closed when EMA9 crosses above EMA21 or RSI rises above 30. The strategy provides intuitive visual feedback by simultaneously displaying moving averages, signal arrows, and background colors on the chart.
This strategy combines several technical advantages that make it perform well in real trading:
Despite its numerous advantages, the strategy also has some potential risks and limitations:
Based on in-depth analysis of the code, the strategy has several potential optimization directions:
The Dual EMA Crossover with RSI Trend Confirmation Strategy provides a balanced approach to trend following by combining EMA crossovers with RSI confirmation. It offers clear entry and exit signals while visually displaying the current market trend through graphic elements. The core strength of the strategy lies in its clear and effective logic, combining market information from both trend and momentum dimensions to improve signal quality. While the strategy has limitations in certain market conditions, it provides a solid foundational framework that can be further refined and customized through the optimization directions mentioned above to suit individual trading preferences and risk tolerance. With appropriate parameter optimization and integration of risk management measures, this strategy has the potential to become a powerful tool in a trader’s arsenal.
/*backtest
start: 2024-03-26 00:00:00
end: 2024-12-08 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("vefaema", overlay=true)
// EMA'ları hesapla
ema9 = ta.ema(close, 9)
ema21 = ta.ema(close, 21)
// RSI hesapla
rsi = ta.rsi(close, 14)
// Trend belirleme kriterleri
bullish = ema9 > ema21 and rsi > 30
bearish = ema9 < ema21 and rsi < 30
// Long ve short sinyalleri
longSignal = ta.crossover(ema9, ema21) and rsi > 30
shortSignal = ta.crossunder(ema9, ema21) and rsi < 30
// Renkleri belirle
plot(ema9, title="EMA 9", color=color.blue)
plot(ema21, title="EMA 21", color=color.orange)
// Grafik üzerine ok ekleme
plotshape(series=longSignal, location=location.belowbar, color=color.green, style=shape.labelup, title="Long")
plotshape(series=shortSignal, location=location.abovebar, color=color.red, style=shape.labeldown, title="Short")
// Trend yönünü simge olarak ekleme
plotshape(series=bullish, location=location.bottom, color=color.green, style=shape.triangleup, title="Bullish Trend")
plotshape(series=bearish, location=location.top, color=color.red, style=shape.triangledown, title="Bearish Trend")
// Arka plan rengi
bgcolor(bullish ? color.new(color.green, 90) : bearish ? color.new(color.red, 90) : na)
// Al/Sat işlemleri
if (longSignal)
strategy.entry("Long", strategy.long)
if (shortSignal)
strategy.entry("Short", strategy.short)
if (ta.crossunder(ema9, ema21) or rsi < 30)
strategy.close("Long")
if (ta.crossover(ema9, ema21) or rsi > 30)
strategy.close("Short")