Type/to search

Dual Moving Average Matching Strategy Based on Bollinger Bands

Common strategy
Created: 2023-11-24 15:32:57
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

The dual moving average matching strategy based on Bollinger Bands is a trend-following strategy that runs with price and volume in the market. It uses the crossover of Bollinger Bands and moving averages as trading signals to implement a quantitative strategy that can automatically identify market trends and trade with stop profit and stop loss rules.

Strategy Principle

This strategy is mainly based on the crossover signals of the Bollinger Bands indicator and the moving average indicator for trading. Specifically, it uses the middle rail, upper rail of Bollinger Bands, and 7 moving averages with lengths from 5 to 200 days at the same time. It generates a buy signal when the price breaks through the middle and lower rails of the Bollinger Bands from bottom to top; it generates a sell signal when the price breaks through the upper rail of the Bollinger Bands from top to bottom to achieve trend following.

In addition, the strategy also introduces the moveToFract indicator for judging long and short positions. This indicator determines whether the current market trend is up or down by calculating the order of arrangement of short-term and long-term moving averages, thus avoiding generating wrong signals in range-bound markets. Finally, combined with configurable stop profit and stop loss rules, it forms a more complete trend following trading strategy.

Advantage Analysis

  1. Flexible configuration that can customize parameter combinations to suit different market environments
  2. Combining two different indicators as filters can reduce erroneous signals
  3. Trend judging indicator can avoid reverse operations in volatile markets
  4. Tracking stop loss setting maximizes profits

Risk Analysis

  1. Parameters should be adjusted appropriately to suit cycles of different timeframes to avoid over-trading
  2. Tracking stop loss may expand losses in a fast decline
  3. Must ensure sufficient funds, otherwise unable to withstand the risk of continuous losses

Optimization Directions

  1. Add golden cross and death cross judgments to further optimize
  2. Different varieties have different parameters, consider machine learning for optimal parameters
  3. Combine with volatility index to determine trend volatility and strengthen risk control

Conclusion

In general, this is a very practical trend following strategy. It uses indicator crossover for decision making, and also incorporates a trend judging module to effectively filter out wrong signals. After configuring stop profit and stop loss, it can fully follow trends for trading and obtain good returns. By adjusting parameter combinations and adding more filters, this strategy can be further optimized to adapt to more market environments, and has great room for improvement and application prospects.

Source
Pine
/*backtest
start: 2023-10-24 00:00:00
end: 2023-11-23 00:00:00
period: 1h
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/
// © HeWhoMustNotBeNamed

//@version=4
Strategy parameters
Strategy parameters
Moving Average Type
Exit Strategy
LookbackPeriod
BBStdDev
BBLength
atrLength
atrMult
Trade Direction
backtestYears
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)