Moving Average Divergence Strategy
1
Follow
1776
Followers
Overview
This strategy detects divergences between price and moving average line, and uses them as buy and sell signals. It can be applied to any oscillator to find divergences. This is a valuable tool that can be used for backtesting and live trading.
Strategy Logic
- Calculate Moving Average (MA) of length Len
- Detect pivot low (PL) and pivot high (PH) points of MA
- Check for bullish divergence: price makes new low but MA does not or MA makes new low but price does not
- Check for bearish divergence: price makes new high but MA does not or MA makes new high but price does not
- Buy and sell based on divergence
Advantage Analysis
- Automatically detect divergences between price and MA, avoid manual judgment errors
- Applicable to any oscillator, strong extensibility
- Can be used to backtest and validate profitability
- Configurable parameters to adjust sensitivity and avoid false signals
- Provide multiple divergence types for accurate and comprehensive judgment
Risk Analysis
- Invalid oscillator settings may generate excessive false signals
- Valid pivot points required before divergence occurs, signals may be insufficient
- Need to adjust parameters to balance sensitivity and filter false signals
- Works better combined with other factors, relatively low confidence when used alone
Optimization Directions
- Optimize MA parameters to find best parameter combinations
- Combine with other indicators like volume to avoid false signals
- Add machine learning model to judge divergence credibility
- Add risk management mechanisms to control per trade loss
Summary
This strategy uses divergences between price and MA as trading signals for automated judgment to avoid subjective errors. It can be widely applied to any oscillator with strong extensibility. Requires parameter optimization and usage with other indicators to significantly improve signal reliability and system stability.
Source
Pine
/*backtest
start: 2023-12-24 00:00:00
end: 2024-01-12 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/
// © tista
//https://www.tradingview.com/u/tista/#published-scripts
Strategy parameters
Related strategies
Comment
All comments (0)
No data
- 1

