
This is an intraday scalping strategy based on Heikin Ashi candles and two simple moving averages (SMA9 and SMA30). The strategy identifies specific reversal patterns—a Doji on the previous candle followed by a no-wick candle, with confirmation against the SMA9—to capture small market movements. This combination approach aims to provide precise entry points for day traders seeking quick, directional market moves.
The core principle of this strategy leverages the smoothing characteristics of Heikin Ashi candles and the trend-indicating function of simple moving averages, combined with specific candlestick pattern recognition to determine entry timing:
Heikin Ashi Transformation: First converts regular candlesticks to Heikin Ashi candles, which smooths price fluctuations and displays trend direction more clearly.
Moving Average Indicators: The strategy calculates and applies two simple moving averages:
Pattern Recognition Mechanism:
Entry Conditions:
Execution Logic: Before entering a new position, the strategy closes any positions in the opposite direction, which helps reduce unnecessary trading costs and risk exposure.
Through in-depth code analysis, this strategy demonstrates the following significant advantages:
Entry Precision: The combination of Doji and no-wick candle pattern recognition captures market breakouts after hesitation, providing high-probability entry points.
Quick Response: Using shorter periods (9 and 30) for moving averages allows the strategy to respond rapidly to market changes, suitable for intraday scalping.
Visual Confirmation: The strategy plots clear green/red arrows marking each signal, allowing traders to visually identify trading opportunities.
Adaptability: Through adjustable Doji threshold and wick threshold parameters, the strategy can be optimized for different markets and timeframes with varying volatility characteristics.
Heikin Ashi Benefits: Utilizes Heikin Ashi candles to reduce market noise, helping traders identify true trend directions more clearly.
Risk Management Awareness: Automatically closes opposite positions before entering new ones, helping control risk exposure.
Multi-Market Applicability: The strategy design is applicable to various financial markets, including forex, cryptocurrencies, and indices.
Despite its clear advantages, the strategy faces the following risk factors:
False Breakout Risk: The market may lack continued momentum after forming a Doji and no-wick candle, leading to false breakouts and losing trades.
Overtrading: In highly volatile but directionless markets, the strategy may generate too many signals, increasing trading costs.
Lack of Stop-Loss Mechanism: The current code does not include automatic stop-loss or take-profit mechanisms, which could lead to significant losses in sudden market reversals.
Slippage and Fee Impact: As a scalping strategy with higher trading frequency, slippage and fees can significantly affect actual returns.
Timeframe Sensitivity: The strategy may perform differently across various timeframes, requiring specific optimization for each timeframe.
Single Indicator Dependency: Primarily relies on price patterns and simple moving averages, lacking multi-indicator confirmation mechanisms, which may increase the risk of false signals.
Market Condition Adaptability: Performance may be inconsistent in highly trending or ranging markets, requiring parameter adjustments based on market conditions.
Based on code analysis, here are several possible optimization directions:
Add Stop-Loss and Take-Profit Mechanisms: Introduce dynamic stop-loss and take-profit based on ATR (Average True Range), or fixed stop-loss and take-profit based on support and resistance levels, to protect capital and lock in profits.
Add Filtering Conditions:
Parameter Adaptation: Implement automatically adjusting dojiThresh and wickThresh parameters based on market volatility, allowing the strategy to adapt to different market conditions.
Time Filter: Add time filtering functionality to avoid trading during specific low-liquidity periods or before/after important news releases.
Multi-Timeframe Analysis: Combine trend information from higher timeframes, trading only in the direction of the main trend to improve win rate.
Partial Position Closing Logic: Implement a stepped profit-taking mechanism, partially closing positions when price reaches specific targets, both securing profits and retaining upside potential.
Add Moving Average Crossover Confirmation: In addition to the current pattern recognition, add fast/slow moving average crossovers as auxiliary confirmation signals.
These optimization directions aim to improve the strategy’s robustness, reduce false signals, and enhance risk management capabilities, thereby improving overall performance while maintaining the core strategy logic.
The “Fast Reversal Heikin Ashi Moving Average Combination Strategy” is a carefully designed intraday scalping system that captures quick reversal opportunities in markets by combining Heikin Ashi candlestick techniques, simple moving averages, and specific price pattern recognition (no-wick candles following Dojis). The strategy’s greatest strengths lie in its entry precision and clarity of pattern recognition, making it suitable for application on shorter timeframes such as M1, M5, or M15.
However, like most scalping strategies, it faces risks including false breakouts, overtrading, and trading costs. To improve the strategy’s robustness, adding stop-loss and take-profit mechanisms, additional filtering conditions, and multi-timeframe analysis are recommended optimization measures.
For traders, thorough backtesting and forward testing verification before live application is essential, along with adjusting position sizing and risk management parameters according to individual risk tolerance and market conditions. When properly applied and optimized, this strategy has the potential to become a valuable component in a day trader’s toolbox.
/*backtest
start: 2024-05-13 00:00:00
end: 2025-05-11 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// (\_/)
// ( •.•)
// (")_(")
//@version=5
strategy("Stratégie Scalp HA SMA9 & SMA30 (Oracle))", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// — Inputs —
lenFast = input.int(9, "Période SMA Rapide", minval=1)
lenSlow = input.int(30, "Période SMA Lente", minval=1)
dojiThresh = input.float(0.3, "Seuil Doji (% du range)", step=0.01)
wickThresh = input.float(0.3, "Seuil Mèche (% du range)", step=0.01)
// — Séries Heikin Ashi —
haTicker = ticker.heikinashi(syminfo.tickerid)
[haOpen, haHigh, haLow, haClose] = request.security(haTicker, timeframe.period, [open, high, low, close])
// — Moyennes mobiles sur haClose —
smaFast = ta.sma(haClose, lenFast)
smaSlow = ta.sma(haClose, lenSlow)
// — Tracés —
plot(smaFast, title="SMA Rapide", color=color.orange)
plot(smaSlow, title="SMA Lente", color=color.blue)
// — Doji sur la bougie précédente —
bodyPrev = math.abs(haClose[1] - haOpen[1])
rangePrev = haHigh[1] - haLow[1]
prevDoji = bodyPrev <= rangePrev * dojiThresh
// — Bougie sans mèche (bougie actuelle) —
rangeCurr = haHigh - haLow
upperWick = haHigh - math.max(haOpen, haClose)
lowerWick = math.min(haOpen, haClose) - haLow
noWick = upperWick <= rangeCurr * wickThresh and lowerWick <= rangeCurr * wickThresh
// — Conditions d'entrée —
isBull = haClose > haOpen
isBear = haClose < haOpen
longCond = prevDoji and noWick and isBull and haClose > smaFast
shortCond = prevDoji and noWick and isBear and haClose < smaFast
// — Exécution des ordres —
if (longCond)
strategy.close("Short")
strategy.entry("Long", strategy.long)
if (shortCond)
strategy.close("Long")
strategy.entry("Short", strategy.short)
// — Signaux visuels de la stratégie —
plotshape(longCond, title="Entrée Long", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(shortCond, title="Entrée Short", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)