Moving Average Range Swallowing Strategy
Overview
The Moving Average Range Swallowing Strategy is a trend following strategy based on moving averages. It determines price trends by calculating crossovers between two moving averages and uses range management to track trends for profit.
Strategy Logic
The strategy uses two moving averages: a fast line and a slow line. The fast line has a smaller parameter and is more sensitive to price changes. The slow line has a larger parameter and determines trends more reliably. It goes long when the fast line crosses above the slow line, and goes short when the fast line crosses below the slow line.
It also introduces multiple auxiliary moving averages to judge the main trend direction to avoid mismatches. In addition, it uses the Highest and Lowest functions together with ATR to calculate dynamic stop loss to lock in profits.
For each trade, the strategy can choose to place orders with a fixed quantity or dynamically calculate the position size based on the maximum loss percentage set in parameters. The latter can keep the risk of each trade within a certain range.
Advantage Analysis
- The dual moving average system can effectively track price trends
- Auxiliary moving averages and directional filters reduce noise trades
- Dynamic stop loss and position sizing limit max loss per trade
- Position sizing system enables exponential profit growth while capping drawdowns
Risk Analysis
- Double MA strategies tend to experience consolidation pinch
- Auxiliary MAs and filters may miss some trading opportunities
- Stop loss may be penetrated during extreme volatility leading to large losses
- Excessive position sizes during extreme moves can lead to huge losses
These risks can be reduced by optimizing MA parameters, adjusting weights of auxiliary MAs, modifying stop loss ranges etc. In addition, strict position sizing rules minimize damage from single trade losses.
Optimization Directions
The strategy can be optimized in the following aspects:
- Test more combinations of moving averages to find optimum parameters
- Add trend strength indicators to avoid losses from trend reversals
- Research adaptive stop loss algorithms to make stops more intelligent
- Optimize position sizing schemes to balance profitability and risk
Summary
Overall, the Moving Average Range Swallowing Strategy is a very practical quantitative trading strategy. It combines both trend following and risk control capabilities, suitable for long term holdings. By optimizing parameters and functionality, the strategy can be made more robust and intelligent for sustained profitability.
/*backtest
start: 2024-01-10 00:00:00
end: 2024-01-17 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
// This is a simple crossover Moving Average strategy, good for long term crypto trades.
// It buys when the MA "X" crosses up the MA "Y", viceversa for shorts. - 1

