Quantitative Moving Average Trend Following Strategy
Overview
This strategy calculates two volume weighted moving averages as fast and slow lines. It determines the trend direction based on the difference between the two lines and takes long or short positions accordingly. The strategy is simple and effective in tracking market trends.
Strategy Logic
-
Calculate fast and slow lines using volume weighted moving averages based on user defined fast and slow periods.
-
Calculate the difference between the fast and slow lines.
-
Determine trend direction. Crossover of fast line above slow line indicates upward trend and crossover below indicates downward trend.
-
Issue long/short signals. Go long when fast line crosses above slow line. Go short when fast line crosses below slow line.
-
Set stop loss based on user defined fixed percentage or dynamic ATR.
-
Exit rules. Close position if stop loss is hit or reverse signal occurs.
Advantages
-
Uses quantitative indicator to identify trends and avoid false breakouts.
-
Fast and slow line combo filters out market noise and avoids overtrading.
-
Stop loss effectively controls downside risk.
-
Simple and easy to understand logic.
-
Customizable parameters for different products and timeframes.
Risks
-
Improper parameter setting may cause overtrading or missed trends.
-
Fixed stop loss may be too rigid for changing market conditions.
-
Changes in volume and price relationships may impact effectiveness.
-
Risk 1 can be mitigated through parameter optimization.
-
Risk 2 can be addressed via dynamic ATR stop loss.
-
Risk 3 needs monitoring volume changes.
Enhancement Opportunities
-
Test different fast and slow line parameter combinations.
-
Try other volume-price indicators like OBV, William's %R etc.
-
Add volatility based stops.
-
Evaluate combining with other indicators.
-
Test effectiveness across different trading instruments.
Conclusion
This strategy uses fast and slow quantified moving averages to track trends with simple logic. Parameters can be optimized and stops control risk. Further evaluations on combining indicators may improve effectiveness.
/*backtest
start: 2023-08-18 00:00:00
end: 2023-09-17 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("EVWMA 6HR", overlay=false, precision=2, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.075)
// Credit to QuantNomad for the main idea behind this code
/////////////// Time Frame ///////////////- 1
