HMA Crossover + ATR + Curvature (Long & Short) β Strategy by emilio_sforza
By emilio_sforza
Performance Metrics
- Author: emilio_sforza
- Symbol: NASDAQ:QQQ
- Timeframe: 15 minutes
- Net P&L: +7,303.27 USD (+7.30%)
- Win Rate: 100.0%
- Max Drawdown: 718.96 USD (0.71%)
- Total Trades: 19
- Sharpe Ratio: 0.281
Description
π Hull Moving Averages (Trend Filters)- fastHMA = ta.hma(close, fastLength)- slowHMA = ta.hma(close, slowLength)These two HMAs act as dynamic trend indicators:- A bullish crossover of fast over slow HMA signals a potential long setup.- A bearish crossunder triggers short interest.β‘οΈ Curvature (Acceleration Filter)- curv = ta.change(ta.change(fastHMA))This calculates the second-order change (akin to the second derivative) of the fast HMA β effectively the acceleration of the trend. It serves as a filter:- For long entries: curv > curvThresh (positive acceleration)- For short entries: curv < -curvThresh (negative acceleration)It helps eliminate weak or stagnating moves by requiring momentum behind the crossover.π Volatility-Based Risk Management (ATR)- atr = ta.atr(atrLength)- stopLoss = atr * atrMult- trailStop = atr * trailMultThese define your:- Initial stop loss: scaled to recent volatility using ATR and atrMult.- Trailing stop: also ATR-scaled, to lock in gains dynamically as price moves favorably.π° Position Sizing via Risk Percent- capital = strategy.equity- riskCapital = capital * (riskPercent / 100)- qty = riskCapital / stopLossThis dynamically calculates the position size (qty) such that if the stop loss is hit, the loss does not exceed the predefined percentage of account equity. Itβs a volatility-adjusted position sizing method, keeping your risk consistent regardless of market conditions.π Execution Logic- Long Entry: on bullish HMA crossover with rising curvature.- Short Entry: on bearish crossover with falling curvature.- Exits: use ATR-based trailing stops.- Position is closed when trend conditions reverse (e.g., bearish crossover exits the long).This framework gives you:- Trend-following logic (via HMAs)- Momentum confirmation (via curvature)- Volatility-aware execution and exits (via ATR)- Risk-controlled dynamic sizingWant to get surgical and test what happens if we use curvature on the difference between HMAs instead? That might give some cool insights into trend strength transitions.