Dynamic Trailing Stop Long Only Trend Following Strategy with Seasonality Filter
Overview
This strategy designs a long-only trend following strategy based on the Dynamic Movement Index (DMI), with an Average True Range (ATR) trailing stop loss to control downside risks. It also incorporates trading hours and S&P500 seasonality filters for further optimization and edge.
Strategy Logic
-
The strategy only enters trades on specified trading days (Mon-Fri) and trading hours (default 9:30am - 8:30pm local time).
-
When ADX is above 27, it signals that the market is in a trend. If the +DI crosses above -DI, a long signal is generated.
-
After opening a position, the stop loss is set at 5.5 x ATR from the entry price, and it trails upwards as price rises to lock in profits.
-
Optionally, S&P500 seasonal patterns are enabled, so that trades happen only during historically bullish periods.
Advantage Analysis
-
Combining trend metrics and stop loss helps effectively ride trends and control loss per trade.
-
Trading hours and seasonality filters help avoid abnormal volatility and reduce false signals.
-
DMI and ATR are mature technical indicators with flexibility in parameter tuning suitable for quant optimization.
Risk Analysis
-
Improper DMI and ATR parameters may lead to too many or too few signals. Parameter tuning is needed.
-
Stop loss set too wide may cause unnecessary stops. Set too tight may fail to control losses.
-
Trading hours and seasonality rules may filter some profitable opportunities. Filter effect needs evaluation.
Optimization Directions
-
Consider combining other indicators like MACD, Bollinger Bands for entry and exit rules.
-
Test different ATR multiples for stop loss, or dynamic adjustment of stop loss scale.
-
Test adjusting trading hours, or optimizing seasonal entry and exit dates.
-
Try applying machine learning methods to auto-tune parameters.
Conclusion
This strategy integrates trend following and risk control techniques to overcome high volatility issues with trend systems. Adding trading hours and seasonal filters further reduces false signals. With parameter tuning and feature expansion, this strategy can achieve more steady profits.
/*backtest
start: 2024-01-27 00:00:00
end: 2024-02-26 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title="DMI Strategy with ADX and ATR-based Trailing SL (Long Only) and Seasonality", shorttitle="MBV-SP500-CLIMBER", overlay=true)
// Eingabeparameter für Long-Positionen- 1

