- Strategy
- Buys when the Heikin-Ashi candle turns bullish with no lower wick while price closes above the 50 EMA, and sells when it turns bearish with no upper wick while price is below the EMA. The stop is 1.5 x ATR and the target is 2R.
- Risk model
- 1% of balance per trade (configurable), stop-loss on every order, one position at a time
What it does
Heikin-Ashi candles average price data to smooth out noise, which makes trends easier to see. A bullish Heikin-Ashi candle with no lower wick is often read as strong buying pressure. This EA trades the first such candle after a bearish one, as long as the regular price is on the right side of a 50 EMA.
The Heikin-Ashi values are calculated inside the EA, so no separate indicator is needed. Trades have an ATR stop-loss and risk-based sizing.
How it works
Heikin-Ashi candles are rebuilt from the last 200 closed bars on each new bar:
- HA close = (open + high + low + close) ÷ 4.
- HA open = (previous HA open + previous HA close) ÷ 2, seeded with (open + close) ÷ 2 on the oldest bar.
- HA high = the highest of the bar high, HA open and HA close; HA low = the lowest of the bar low, HA open and HA close.
- Buy: the last closed HA candle is bullish, the one before was bearish, and the new candle has no lower wick (its low equals the lower of its open and close, within the tolerance).
- Sell: the mirror with no upper wick.
- Filter: the regular close must be above the 50 EMA for buys and below it for sells.
- Stop-loss: 1.5 x ATR(14). Target: 2R. Exit: by default a long closes when an HA candle turns bearish.
How to use it
This EA suits trending instruments on H1 and H4. Note that orders are placed at real market prices, not Heikin-Ashi prices; the HA candles are only used to decide when to act. A small wick tolerance (a few points) allows near-perfect candles and increases the number of signals.
If you want to understand the averaging behind the candles, the technical analysis basics lesson is a good starting point.
Settings
| Input | Default | What it changes |
|---|---|---|
| Wick tolerance (points) | 0 | Wick size still treated as 'no wick'. |
| Trend filter EMA period | 50 | Signals are taken only on the matching side of this EMA. |
| Bars used for Heikin-Ashi | 200 | History used to rebuild the candles. |
| Stop-loss distance (x ATR) | 1.5 | Stop distance as a multiple of ATR(14). |
| Take-profit (R multiple) | 2.0 | Target as a multiple of the stop distance. |
| Exit on color change | true | Closes when the candle color turns against the trade. |
| Risk per trade (% of balance) | 1.0 | Share of balance risked between entry and stop. |
| Fixed lots | 0 | Fixed volume instead of risk %; 0 = risk-based. |
| Maximum spread (points) | 20 | Skips signals when the spread is wider; 0 = off. |
| Trading start / end hour | 7 / 20 | Server-time window for new trades; equal values = 24 hours. |
| Move stop to break-even | true | Stop to entry + 20 points once profit reaches 1R. |
| Use trailing stop | false | Trails the stop 2 x ATR behind price. |
| Magic number | 2611011 | Identifies this EA's trades. |
Limitations
- Heikin-Ashi smoothing delays color changes, so entries come after the turn in real price.
- The "no wick" rule is strict and can skip many trend starts.
- The color-change exit can close a trade on one small counter candle.
- Heikin-Ashi values depend on how much history is used to seed them; the first few bars of the window can differ slightly from a chart indicator.
Before you run it live
Test on a demo account and in the MetaTrader 5 Strategy Tester over several years first. No backtest results are published for this EA, and any test describes the past only.
- Match the spread limit and trading hours to your broker's spreads, stop level and session times, and include commission and swap in tests.
- Start with 1% risk or less and check the lot sizes in the Experts log; the Position Size Calculator is a useful cross-check.
- Use a different magic number on each chart, and keep the terminal (or a VPS) running so stops are managed.
Compare a few signals in visual mode against a Heikin-Ashi chart to confirm the candles line up on your broker's data.

