Multi-Moving Average and Indicator Cross Trend Following Quantitative Trading System

EMA MACD RSI VOLUME MA
Created on: 2025-02-08 14:58:45 Modified on: 2025-02-08 14:58:45
Copy: 1 Number of hits: 340
avatar of ChaoZhang ChaoZhang
1
Follow
1617
Followers

 Multi-Moving Average and Indicator Cross Trend Following Quantitative Trading System

Overview

This is a trend-following trading system based on multiple indicators, combining Exponential Moving Averages (EMA), MACD indicator, RSI indicator, and volume analysis. The strategy analyzes the relationships between short-term, medium-term, and long-term moving averages, combined with momentum indicators and volume confirmation to execute trades when market trends are clear. The system also incorporates support and resistance analysis to further enhance trading accuracy.

Strategy Principles

The strategy is based on the following core elements: 1. Multiple EMA System: Uses 5, 14, 34, and 55-period EMAs to confirm trend direction. An uptrend is identified when shorter-period EMAs are above longer-period EMAs, and vice versa. 2. MACD Indicator: Confirms market momentum. Positive MACD histogram indicates strong upward momentum; negative values indicate strong downward momentum. 3. RSI Indicator: Confirms market strength/weakness. RSI above 50 indicates market strength, below 50 indicates market weakness. 4. Volume Analysis: Requires volume to be 1.5 times greater than the 20-period volume average to ensure sufficient market activity. 5. Support/Resistance Levels: Calculates short-term support and resistance levels using 20-period high and low prices.

Strategy Advantages

  1. Multi-dimensional Analysis: Combines multiple technical indicators to reduce false signals.
  2. Trend Confirmation: Uses multiple moving average system for more accurate trend identification.
  3. Momentum Verification: Combines MACD and RSI to confirm trends while avoiding chasing extremes.
  4. Volume-Price Integration: Uses volume as a necessary condition for trade confirmation.
  5. Risk Control: Provides reference points for stop-loss and take-profit through support/resistance analysis.

Strategy Risks

  1. Choppy Market Risk: May generate frequent false signals in range-bound markets.
  2. Lag Risk: Strategy has inherent lag due to the use of multiple moving averages.
  3. Cost Risk: Frequent trading may result in high transaction costs.
  4. Market Environment Dependency: Strategy performs well in strong trend markets but may underperform in other conditions.

Optimization Directions

  1. Parameter Optimization: Optimize indicator periods through historical data backtesting.
  2. Stop-Loss Optimization: Add dynamic stop-loss mechanisms like trailing stops or ATR-based stops.
  3. Market Environment Classification: Add market environment assessment module to use different parameters in different conditions.
  4. Signal Filtering: Add trend strength filters to avoid trading in weak trend environments.
  5. Position Management: Implement dynamic position sizing based on signal strength.

Summary

This strategy is a comprehensive trend-following system that combines multiple technical indicators to ensure trading reliability while maintaining risk control capabilities. Its core strength lies in its multi-dimensional analysis approach, although market conditions significantly impact its performance. Through continuous optimization and refinement, the strategy has the potential to achieve better results in actual trading.

Strategy source code
/*backtest
start: 2022-02-09 00:00:00
end: 2025-02-06 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Advanced EMA + MACD + RSI Strategy with Support/Resistance", overlay=true)

// Parametreler
shortEMA = input(5, title="Kısa Vadeli EMA (5)")
mediumEMA = input(14, title="Orta Vadeli EMA (14)")
longEMA = input(34, title="Uzun Vadeli EMA (34)")
extraLongEMA = input(55, title="Ekstra Uzun Vadeli EMA (55)")
rsiLength = input(14, title="RSI Periyodu")
macdShortLength = input(12, title="MACD Kısa Periyot")
macdLongLength = input(26, title="MACD Uzun Periyot")
macdSignalLength = input(9, title="MACD Signal Periyot")
volumeMultiplier = input(1.5, title="Hacim Çarpanı")

// EMA Hesaplamaları
ema5 = ta.ema(close, shortEMA)
ema14 = ta.ema(close, mediumEMA)
ema34 = ta.ema(close, longEMA)
ema55 = ta.ema(close, extraLongEMA)

// MACD Hesaplamaları
[macdLine, signalLine, _] = ta.macd(close, macdShortLength, macdLongLength, macdSignalLength)
macdHist = macdLine - signalLine

// RSI Hesaplaması
rsi = ta.rsi(close, rsiLength)

// Destek ve Direnç Hesaplamaları (en yüksek ve en düşük değerler)
highestHigh = ta.highest(high, 20)
lowestLow = ta.lowest(low, 20)

// Hacim Kontrolü
avgVolume = ta.sma(volume, 20)
volumeCondition = volume > avgVolume * volumeMultiplier

// Alım ve Satım Koşulları
longCondition = ema5 > ema14 and ema14 > ema34 and ema34 > ema55 and close > ema34 and macdHist > 0 and rsi > 50 and volumeCondition
shortCondition = ema5 < ema14 and ema14 < ema34 and ema34 < ema55 and close < ema34 and macdHist < 0 and rsi < 50 and volumeCondition

// Alım ve Satım İşlemleri
if (longCondition)
    strategy.entry("Long", strategy.long)

if (shortCondition)
    strategy.entry("Short", strategy.short)

// Grafik Üzerinde Göstergeler
plot(ema5, color=color.blue, title="5 EMA")
plot(ema14, color=color.green, title="14 EMA")
plot(ema34, color=color.red, title="34 EMA")
plot(ema55, color=color.purple, title="55 EMA")
hline(50, "RSI 50", color=color.gray, linestyle=hline.style_dotted)
plot(highestHigh, color=color.orange, title="Direnç", linewidth=2)
plot(lowestLow, color=color.red, title="Destek", linewidth=2)