Type/to search

Bidirectional Moving Average Reversion Trading Strategy

Common strategy
Created: 2024-01-15 12:15:14
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

The Bidirectional Moving Average Reversion Trading Strategy is a quantitative trading strategy built on the theory of price mean reversion. This strategy captures price reversal opportunities by setting up multiple moving averages and entering the market when the price deviates significantly from the moving averages, and exiting when it reverts back.

Strategy Logic

The core idea of this strategy is price mean reversion, which suggests that prices tend to fluctuate around an average value, and have a higher chance of reverting back when they deviate too far from the average. Specifically, this strategy sets up three groups of moving averages: entry moving averages, exit moving averages, and stop-loss moving averages. It will open corresponding long or short positions when prices hit the entry moving averages; close positions when prices hit the exit moving averages; and control losses with stop-loss moving averages in case prices continue to trend without reverting back.

From the code logic perspective, there are two entry moving averages - long and short - consisting of fast and slow moving averages respectively. The deviation between them and the price determines the position size. In addition, the exit moving average is a separate moving average that signals when to close the positions. When prices hit this line, existing positions will be flattened.

Advantage Analysis

The main advantages of the bidirectional moving average reversion strategy include:

  1. Capturing price reversals, suitable for range-bound markets
  2. Controlling risks through stop losses
  3. Highly customizable parameters for adaptability
  4. Easy to understand, convenient for parameter optimization

This strategy works well with low volatility instruments that have relatively small price swings, especially when entering range-bound cycles. It can effectively capture opportunities from temporary price reversals. Meanwhile, the risk control measures are quite comprehensive, capping losses within reasonable ranges even if prices do not revert back.

Risk Analysis

There are also some risks associated with this strategy:

  1. Chasing trends risk. Consecutive new positions may lead to liquidation during strong trending moves.
  2. Excessive price swings risk. Stop losses could be hit by increased volatility.
  3. Parameter optimization risk. Inappropriate parameter settings may lead to significant underperformance.

Some ways to mitigate the above risks include:

  1. Limiting new entries to avoid overtrading
  2. Reducing position sizes to limit liquidation risks
  3. Optimizing parameters like moving average periods and exit line multipliers

Optimization Directions

There is also ample room to further optimize this strategy:

  1. Add additional entry logic to prevent trend chasing
  2. Incorporate adaptive position sizing against volatility
  3. Experiment with different types of moving averages
  4. Machine learning for automated parameter optimization
  5. Incorporate trailing stops for more dynamic risk management

Conclusion

The bidirectional moving average reversion trading strategy aims to profit from price reversals after significant deviations from its moving average levels. With proper risk control measures, it can achieve consistent profits through parameter tuning. While risks like chasing trends and excessive volatility still exist, they can be addressed through improving entry logic, reducing position sizes and more. This easy-to-understand strategy deserves further research and optimization from quantitative traders.

Source
Pine
/*backtest
start: 2023-12-15 00:00:00
end: 2024-01-14 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy(title = "hamster-bot MRS 2", overlay = true, default_qty_type = strategy.percent_of_equity, initial_capital = 100, default_qty_value = 30, pyramiding = 1, commission_value = 0.1, backtest_fill_limits_assumption = 1)
info_options = "Options"
Strategy parameters
Strategy parameters
long1on
Long
Lot 1
short1on
short
Lot 1
Start date
Final date
Options
Entry on close
Offset View
Trade
Use Kalman filter
MA Opening Long
maopeningtyp_l
maopeningsrc_l
maopeninglen_l
MA Opening Short
maopeningtyp_s
maopeningsrc_s
maopeninglen_s
MA Closing
maclosingtyp
maclosingsrc
maclosinglen
mul
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)