This strategy is named “Moving Average Range Reversal”. It identifies market reversal opportunities by calculating crossovers between moving averages of different timeframes and takes appropriate long/short positions.
The strategy computes 3 moving averages simultaneously:
When fast MA crosses above slow MA, it signals a short-term trend reversal to bullish. When fast MA crosses below slow MA, it signals a short-term reversal to bearish.
To avoid false signals, a 4th MA is introduced as the long-term filter (tlenght). Only above this filter long signals are considered. Only below this filter short signals are considered.
The specific trading rules are:
When fast MA crosses above slow MA, and slow MA also crosses above slowest MA (short-term bullish), while price is above the long-term filter, go long. When fast MA crosses below slow MA, close long position.
When fast MA crosses below slow MA, and slow MA also crosses below slowest MA (short-term bearish), while price is below the long-term filter, go short. When fast MA crosses above slow MA, close short position.
The advantages of this strategy include:
The risks of the strategy include:
Solutions:
The strategy can be improved in the following aspects:
This strategy trades market reversals identified by MA crossovers, with direction guidance from the long-term filter. It effectively captures opportunities at turning points. The positive backtest results show good profitability for live application. Further optimizations on parameters, signal filtering, stop loss etc. can make the strategy more robust for practical use.
/*backtest start: 2023-12-01 00:00:00 end: 2023-12-31 23:59:59 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Moving Average Trap", overlay=true) flenght = input.int(title="Fast MA Period", minval=1, maxval=2000, defval=3) llenght = input.int(title="Slower MA Period", minval=1, maxval=2000, defval=5) sslenght = input.int(title="Slowest MA Period", minval=1, maxval=2000, defval=8) tlenght = input.int(title="Trend Filter MA Period", minval=1, maxval=2000, defval=200) ssma = ta.sma(close, sslenght) fma = ta.sma(close, flenght) sma = ta.sma(close, llenght) tma = ta.sma(close, tlenght) plot(fma, color=color.red) plot(sma, color=color.white) plot(ssma, color=color.green) plot(tma, color=color.maroon, linewidth=2) short = (fma > sma and sma > ssma) and close < tma long = (fma < sma and sma < ssma) and close > tma closeshort = fma < sma and sma < ssma closelong = fma > sma and sma > ssma if long strategy.entry("long", strategy.long) if closelong strategy.close("long") if short strategy.entry("short", strategy.short) if closeshort strategy.close("short") //plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)