This is a crossover strategy based on 4 EMA lines. It uses two sets of fast and slow EMAs and generates buy signals when both fast EMAs cross above their corresponding slow EMAs, and sell signals when both fast EMAs cross below their corresponding slow EMAs. The strategy can effectively capture mid-to-long term trends and make profits in ranging markets.
The strategy employs 4 exponential moving averages (EMAs), including 2 fast EMAs and 2 slow EMAs. The fast EMAs have lengths of 9 and 21 days, used to catch short-term trends; while the slow EMAs have lengths of 50 and 200 days, used to determine mid-to-long term trend directions.
When the fast 9-day EMA crosses above the 50-day EMA from below, and the 21-day EMA also crosses above the 200-day EMA from below, a buy signal is generated, referred to as a “golden cross”. This indicates uptrends for both short-term and mid-term trends, suitable for establishing long positions.
On the contrary, when the fast 9-day EMA crosses below the 50-day EMA from above, and the 21-day EMA also crosses below the 200-day EMA from above, a sell signal is generated, referred to as a “dead cross”. This indicates downtrends for both short-term and mid-term trends, suitable for closing long positions or establishing short positions.
This four EMA crossover strategy incorporates analysis across multiple timeframes and can effectively determine market trends and make profits in ranging markets. The main advantages include:
Capturing mid-to-long term trends: The combination of fast and slow EMAs can effectively determine trend directions across short, mid and long timeframes, reducing false signals.
Filtering noise: EMAs themselves have noise filtering capabilities, avoiding being trapped by normal market noise.
Profitability: It captures golden cross buy opportunities and dead cross sells in a timely manner to realize trading profits.
Customizability: Users can freely adjust parameters of the 4 EMAs to adapt to different products and timeframes.
Extendibility: The strategy can be extended by introducing other indicators to construct more complex quantitative strategies.
There are also some inherent risks with this four EMA strategy:
False breakout risk: The market may have false golden crosses and dead crosses, making the trading signals unreliable. This can be mitigated by adjusting EMA parameters or introducing confirming indicators to reduce false signals.
Ranging risk: More trades and increased costs may occur in sideways and ranging markets due to more frequent trading signals. Appropriate stop loss and take profit conditions should be set to limit profits and losses for each trade.
Systematic risk: This strategy focuses on technical analysis while ignoring fundamental analysis. Technical indicators may fail when significant company or economic events occur. It’s recommended to combine fundamental analysis with this strategy.
There is room for further optimization of this four EMA crossover strategy:
Introduce auto-optimization scripts: Write scripts to comprehensively optimize the lengths of the four EMAs, searching for optimal parameter combinations.
Add confirming conditions: Increase additional confirming indicators when generating trading signals, like surges in trading volumes, to avoid false signals.
Consider seasonality: Adjust strategy parameters based on seasonal patterns of different futures contracts to profit from contracts with pronounced seasonality.
Stop loss and take profit: Set reasonable stop loss and take profit points to limit maximum loss for each trade.
Strategy combination: This strategy can serve as a basic strategy to introduce machine learning algorithms, combining with other technical indicator strategies to construct complex quantitative strategies.
This is a very effective four EMA crossover strategy. It determines market trend directions by using two sets of fast and slow EMA crossovers to generate tradable signals. While capturing mid-to-long term trends, it also filters normal market noise. It has advantages like flexible parameter tuning and strong extendibility. We also analyzed its risks and future optimization directions. Overall, this is a reliable and profitable quantitative trading strategy.
/*backtest start: 2023-11-14 00:00:00 end: 2023-12-14 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy("Four EMA Crossover", overlay=true) // Input parameters fast1Length = input(9, title="Fast EMA 1 Length") fast2Length = input(21, title="Fast EMA 2 Length") slow1Length = input(50, title="Slow EMA 1 Length") slow2Length = input(200, title="Slow EMA 2 Length") // Calculate EMAs fastEMA1 = ema(close, fast1Length) fastEMA2 = ema(close, fast2Length) slowEMA1 = ema(close, slow1Length) slowEMA2 = ema(close, slow2Length) // Plot EMAs on the chart plot(fastEMA1, color=color.blue, title="Fast EMA 1") plot(fastEMA2, color=color.green, title="Fast EMA 2") plot(slowEMA1, color=color.red, title="Slow EMA 1") plot(slowEMA2, color=color.purple, title="Slow EMA 2") // Strategy logic - Buy when fast EMA crosses above slow EMA and sell when fast EMA crosses below slow EMA longCondition = crossover(fastEMA1, slowEMA1) and crossover(fastEMA2, slowEMA2) shortCondition = crossunder(fastEMA1, slowEMA1) and crossunder(fastEMA2, slowEMA2) strategy.entry("Long", strategy.long, when = longCondition) strategy.entry("Short", strategy.short, when = shortCondition) // Plot strategy entry points on the chart plotshape(series=longCondition, title="Buy Signal", color=color.green, style=shape.triangleup, location=location.belowbar) plotshape(series=shortCondition, title="Sell Signal", color=color.red, style=shape.triangledown, location=location.abovebar)