Blog / Strategy
Strategy

Heikin Ashi Trend Shift

Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.

What Is This Strategy?

The Heikin Ashi Trend Shift is a trend-following continuation strategy built on Heikin-Ashi candles — a smoothed version of the standard Japanese candlestick chart. Where raw price candles flip colour from one bar to the next and produce a great deal of visual noise, Heikin-Ashi averages each candle into its neighbours, turning choppy price action into cleaner, more persistent runs of a single colour. This makes it easier to read who is in control of the market. The strategy is designed to trade the exact moment the smoothed candle colour shifts back in the direction of an established trend, treating that shift as a continuation signal rather than a guess at a market top or bottom.

The approach is built for trending markets. It pairs the Heikin-Ashi colour shift with an Exponential Moving Average (EMA) trend filter — a moving average that weights recent prices more heavily — so that it only looks for long entries while price trades above the EMA, and short entries while price trades below it. In the sideways chop around the average, the two filters effectively cancel each other and the strategy tends to stand aside. This regime-gate design is what keeps the system aligned with the prevailing direction instead of fighting it.

As a learning tool, this strategy suits traders who want to study how smoothing techniques, trend filters, and volatility-based risk management fit together in a single objective, rule-based system. Every condition is measured on closed bars only, so there is nothing subjective to interpret. It is best treated as a structured example of continuation-trade logic — a way to understand how a mechanical trend-follower is assembled — not as a shortcut to results.

How It Works

The strategy evaluates its rules once per newly-closed bar on the primary timeframe. It uses three ingredients: the Heikin-Ashi candle colour, an EMA trend filter, and the Average True Range (ATR), a common measure of market volatility. Here is how the pieces fit together.

Heikin-Ashi calculation (never repaints):

Entry conditions — the colour shift:

Exit conditions:

The system holds only one position at a time per Magic number, and it never stacks entries. Each signal acts once, on the close of a new bar.

Heikin Ashi Trend Shift EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
EmaPeriod 50 20 200 Lookback period of the EMA trend filter on raw closes. Longs are only considered above it, shorts only below it.
AtrPeriod 14 7 30 Lookback for the ATR volatility measure used by the noise gate, the stop, and the trailing stop.
BodyAtrFrac 0.15 0.00 1.50 Minimum Heikin-Ashi shift-candle body size, as a fraction of ATR. Higher values demand stronger candles and reject more noise.
AtrStopMult 1.50 0.50 5.00 Initial stop-loss distance from entry, expressed in ATR multiples.
RewardRatio 2.00 1.00 6.00 Take-profit distance as a multiple of the stop distance (the reward-to-risk ratio).
TrailAtrMult 1.50 0.00 5.00 ATR trailing-stop distance. Set to 0 to disable trailing entirely.
Lots 0.10 0.01 1.00 Order volume in lots.
Magic 5731 0 9,999,999 Unique identifier so the EA manages only its own positions.
Heikin Ashi Trend Shift EA — MQL5 source code

Recommended Chart Settings

The Heikin Ashi Trend Shift was designed with a liquid instrument and an intraday-to-swing timeframe in mind — for example a forex major such as EURUSD or a metal such as XAUUSD (gold) on the H1 (1-hour) chart. That said, every calculation reads the chart's own timeframe and every risk level is ATR-scaled, so the logic ports to other symbols and timeframes without hard-coded values.

Because market behaviour changes over time and differs between instruments, results will vary considerably across different symbols, sessions, and market conditions. Any timeframe or symbol you choose should be studied on its own before it is relied upon, ideally by observing how the colour-shift and EMA-filter interaction behaves on that specific chart.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Like any mechanical system, the Heikin Ashi Trend Shift has clear strengths and equally clear limitations that are worth understanding before committing to it.

Strengths of the approach:

Known limitations:

The honest summary is that this is a competent illustration of continuation-trade construction that may indicate trend resumption under favourable conditions, but it is not a solution for all markets and will experience losing streaks during choppy or news-driven phases.

Risk Management Tips

Sound risk management matters far more to long-term outcomes than any single entry rule. Whatever strategy you study, these general principles are worth internalising:

Risk Warning

Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.

Downloads

← Back to Blog