Type/to search

Dual Moving Average Breakout Strategy

Common strategy
Created: 2024-02-04 16:06:46
Last modified: 2 years ago
1
Follow
1802
Followers

img

Overview

The dual moving average breakout strategy is a typical trend following quantitative trading strategy. It generates trading signals by calculating simple moving averages of different periods and checking if the price breaks through them to determine positions. This strategy uses 20-day and 60-day moving averages as trading signals.

Strategy Logic

The core logic of the dual MA strategy is to use moving averages of different periods to capture price trends and generate trading signals when the price breaks through the moving averages.

Specifically, this strategy employs 20-day and 60-day simple moving averages. These two moving averages can be seen as tools to capture short-term and medium-long term trends respectively. When the short term price breaks through the medium-long term price, it signals that the market is in an upward trend and thus should go long. When the short term price drops below the medium-long term price, it signals that the market is in a downward trend and thus positions should be reduced.

The code uses ta.crossover and ta.crossunder to determine if the price has broken through or dropped below a moving average. Trading signals of going long or reducing position are emitted accordingly when a breakout happens.

Advantages

The dual moving average breakout strategy has the following advantages:

  1. The concept is simple and easy to understand and implement.
  2. It can effectively track market trends and avoid noise interference.
  3. Few strategy parameters and easy to optimize.
  4. Flexible in choosing moving average periods to adjust market sensitivity.

Risks

There are also some risks with the strategy:

  1. Prone to whipsaws when market is ranging. Can be alleviated by increasing holding period.
  2. Ineffective in catching quick market reversals. Other indicators can be added as filters.
  3. Moving averages inherently lagging, unable to early signal price changes. Shortening period may help.

Enhancement Areas

The strategy can be enhanced from the following dimensions:

  1. Optimize moving average periods to find best parameter sets.
  2. Add other indicators to filter out false signals, e.g. MACD, KD etc.
  3. Add stop loss logic.
  4. Incorporate multi-timeframe analysis for robustness.

Summary

The dual moving average breakout strategy is a simple and practical trend following strategy. It can effectively capture medium-long term trends while avoiding short-term market noise. Also, the easy-to-understand logic and limited parameters make it very suitable for quantitative trading. Of course there are rooms for improvements, such as parameter tuning, signal filtering and stop loss to make it more stable and profitable.

Source
Pine
/*backtest
start: 2024-01-04 00:00:00
end: 2024-02-03 00:00:00
period: 4h
basePeriod: 15m
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/
// © Astorhsu

//@version=5
Strategy parameters
Strategy parameters
backtest_year
backtest_month
backtest_day
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)