
This strategy is a trend-following trading system based on multiple Exponential Moving Averages (EMA), Relative Strength Index (RSI), and Moving Average Convergence Divergence (MACD). It identifies market trends through multiple EMA alignments, validates entry timing with RSI and MACD momentum confirmation, and manages risk and profit using EMA-based stop-loss and take-profit methods.
The strategy employs an “EMA Cascade” formation using 5, 14, 34, and 55-period EMAs to determine trend direction. For uptrends, it requires EMA5>EMA14>EMA34>EMA55; the opposite for downtrends. Trade signals are triggered when the MACD line crosses the zero line and RSI is above 50 (for longs) or below 50 (for shorts). Stop-loss is set at the 34-period EMA, with a take-profit target at 3 times the stop-loss distance.
This is a well-designed trend-following strategy that ensures trading reliability and effective risk control through multiple technical indicators’ coordination. While the strategy may underperform in ranging markets, its performance and stability can be further enhanced through the suggested optimizations. For live trading, it’s recommended to conduct thorough backtesting and parameter optimization, with specific adjustments based on market characteristics.
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-16 08:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA + MACD + RSI Strategy", overlay=true)
// Parametreler
length5 = 5
length14 = 14
length34 = 34
length55 = 55
rsiLength = 14
macdShort = 12
macdLong = 26
macdSignal = 9
// EMA Hesaplamaları
ema5 = ta.ema(close, length5)
ema14 = ta.ema(close, length14)
ema34 = ta.ema(close, length34)
ema55 = ta.ema(close, length55)
// RSI Hesaplaması
rsi = ta.rsi(close, rsiLength)
// MACD Hesaplaması
[macdLine, signalLine, _] = ta.macd(close, macdShort, macdLong, macdSignal)
macdZeroCross = ta.crossover(macdLine, 0) or ta.crossunder(macdLine, 0)
// Alış ve Satış Koşulları
longCondition = ema5 > ema14 and ema14 > ema34 and ema34 > ema55 and macdZeroCross and rsi > 50
shortCondition = ema5 < ema14 and ema14 < ema34 and ema34 < ema55 and macdZeroCross and rsi < 50
// Plotlar
plot(ema5, color=color.blue, linewidth=1)
plot(ema14, color=color.green, linewidth=1)
plot(ema34, color=color.red, linewidth=1)
plot(ema55, color=color.orange, linewidth=1)
plot(rsi, title="RSI", color=color.purple, linewidth=1, style=plot.style_line)
// Alış ve Satış Sinyalleri
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Stop-loss ve Take-profit hesaplamaları
stopLoss = ema34
takeProfit = stopLoss * 3
// Stop-loss ve Take-profit Stratejisi
strategy.exit("Exit Long", from_entry="Long", stop=stopLoss, limit=takeProfit)
strategy.exit("Exit Short", from_entry="Short", stop=stopLoss, limit=takeProfit)