Tags:

The moving average crossover trading strategy generates buy and sell signals when shorter and longer term moving averages cross. It belongs to technical analysis based trading strategies. This strategy is simple, capital efficient with smaller drawdowns, suitable for medium-long term trading.

This strategy calculates the 20 and 50 period Exponential Moving Average (EMA). It triggers long position when the 20 EMA crosses over 50 EMA. It triggers short position when 20 EMA crosses under 50 EMA.

EMA gives more weight to recent data. The formula is:

EMAtoday = (Pricetoday * k) + EMAyesterday * (1-k)

Where k = 2/(number of periods + 1)

When shorter term EMA crosses over longer term EMA, it indicates bullish price move to LONG. When it crosses under, it indicates bearish price reversal to SHORT.

The pros of this strategy:

- Simple logic, easy to understand and execute
- Less capital required, smaller drawdowns
- Flexible parameter tuning for different markets
- Applicable to any instruments for scalping or trend trading

The risks include:

- Frequent trading signals during price oscillation. Filters can help.
- Stop loss needed to avoid being trapped.
- Parameter optimization requires more historical data.

Enhancements:

- Adding filters like Bollinger Bands to reduce false signals
- Adding stop loss/take profit to avoid being trapped
- Finding optimal parameter sets for different instruments
- Combining with volume to confirm signals

The moving average crossover strategy is a simple yet effective technical strategy that is proven by the market. Further improvements on risk control and robustness can be achieved by parameter tuning, adding filters etc. It serves as a fundamental building block for quantitative trading.

/*backtest start: 2022-11-20 00:00:00 end: 2023-11-26 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © brandlabng //@version=5 //study(title="Holly Grail", overlay = true) strategy('HG|E15m', overlay=true) src = input(close, title='Source') price = request.security(syminfo.tickerid, timeframe.period, src) ma1 = input(20, title='1st MA Length') type1 = input.string('EMA', '1st MA Type', options=['EMA']) ma2 = input(50, title='2nd MA Length') type2 = input.string('EMA', '2nd MA Type', options=['EMA']) price1 = if type1 == 'EMA' ta.ema(price, ma1) price2 = if type2 == 'EMA' ta.ema(price, ma2) //plot(series=price, style=line, title="Price", color=black, linewidth=1, transp=0) plot(series=price1, style=plot.style_line, title='1st MA', color=color.new(#219ff3, 0), linewidth=2) plot(series=price2, style=plot.style_line, title='2nd MA', color=color.new(color.purple, 0), linewidth=2) longCondition = ta.crossover(price1, price2) if longCondition strategy.entry('Long', strategy.long) shortCondition = ta.crossunder(price1, price2) if shortCondition strategy.entry('Short', strategy.short)

- Bollinger Bands Strategy with RSI Filter
- A Trend Following Strategy Based on Keltner Channels
- RSI Moving Average Crossover Strategy
- momentum breakout trading strategy
- Dynamic RSI and CCI Combined Multi-factor Quantitative Trading Strategy
- Super Z Quantitative Trend Strategy
- Candlestick Pattern Strategy
- CK Momentum Reversal Stop Loss Strategy
- Dual Moving Average Oscillation Breakthrough Strategy
- Momentum Smooth Moving Average Line and Moving Average Line Crossover Strategy
- Range Breakthrough Dual Moving Average Filtering Strategy
- Cross Moving Average Price Strategy
- No Nonsense SSL Channel Trading Strategy
- Momentum Breakout Moving Average Strategy
- Dual Moving Average Crossover Breakout Strategy
- Double Filtering High Frequency Quantitative Trading Strategy
- Quantitative Trading Strategy Based on RSI Indicator
- Trend Following Strategy Based on Moving Averages
- Four Indicator Momentum Reversal Strategy
- London MACD RSI Bitcoin Trading Strategy