The EA runs its full logic once per closed bar, in five stages.
1. Signal — the colour flip Heikin-Ashi bars are recalculated on each new bar. When a bar's colour changes relative to the previous bar (bearish → bullish, or bullish → bearish), the EA registers a directional arrow and arms a pending signal. Heikin-Ashi averaging smooths out the noise that causes raw candles to flip back and forth in choppy conditions, so reversals are marked with fewer false alarms.
2. Trigger — channel re-entry An arrow alone does not open a trade. The EA then waits for price to close back inside or through a Keltner-style channel (EMA ± ATR × multiplier) in the arrow's direction:
This is the core filter of the system. It stops the EA from buying into a falling knife the moment a single bar changes colour, and instead waits for price to demonstrate it has actually returned into the value area. If the trigger does not occur within MaxBarsToTrigger bars, the pending signal expires and is discarded (set to 0 to wait indefinitely).
3. Filters Before any order is sent, three independent filters must all pass:
4. Order placement Lot size is calculated from the distance between entry and stop, so the monetary risk stays constant regardless of how wide the structural stop happens to be. Take profit is placed at RR_Ratio × the risk distance (1.5 by default). The EA validates the stop distance against the broker's StopLevel before sending, so you get a clear log message instead of a silent error 130.
5. Trade management
Only one position is held at a time per symbol and magic number.
Signal and channel
| Input | Default | Meaning |
|---|---|---|
| HeikinAshiBars | 60 | Lookback recomputed each new bar |
| Channel_MA_Period | 20 | EMA period for the channel midline |
| Channel_ATR_Period | 20 | ATR period for channel width |
| Channel_Multiplier | 1.5 | Band distance = ATR × this |
| MaxBarsToTrigger | 15 | Bars to wait for the trigger; 0 = wait indefinitely |
Risk and targets
| Input | Default | Meaning |
|---|---|---|
| RiskMode | RISK_PERCENT | Risk as % of balance, or a fixed cash amount |
| RiskValue | 1.0 | Percent or currency amount, per RiskMode |
| RR_Ratio | 1.5 | Take profit as a multiple of risk |
| UseInitialStopLoss | true | Send a hard stop to the broker |
| SLMethod | SL_SWING_STRUCTURE | Swing-based or ATR-based stop |
| SwingLookbackBars | 10 | Bars scanned for the swing low/high |
| SL_BufferPips | 20 | Extra room beyond the swing point |
| FixedLots | 0.01 | Fallback if the risk calculation fails |
Break-even
| Input | Default | Meaning |
|---|---|---|
| UseBreakEven | true | Enable break-even management |
| BreakEvenTriggerPct | 50 | % of TP distance before the stop moves |
| BreakEvenLockPips | 2 | Pips locked beyond entry |
Filters and general
| Input | Default | Meaning |
|---|---|---|
| UseTimeFilter / TradeStartHour / TradeEndHour | true / 7 / 21 | Session window, server time |
| AvoidFridayLateSession / FridayCutoffHour | true / 20 | Skip the Friday close |
| UseLiquidityFilter / MinVolumeRatio | true / 0.5 | Minimum tick volume vs average |
| UseLargeCandleFilter / MaxATRPips | true / 100 | Skip abnormally volatile conditions |
| CloseOnOppositeSignal | true | Close on a reversal arrow |
| PointsPerPip | 10 | 10 for 3/5-digit quotes, 1 for 2/4-digit |
| DebugLog | true | Print decision diagnostics to the Journal |
Set PointsPerPip correctly for your broker before anything else — it drives every pip-based input (stop buffer, break-even lock, ATR filter). Use 10 if XAUUSD is quoted with 3 decimals (3450.500) and 1 if it shows 2 decimals (3450.50). Getting this wrong will make your stops ten times too wide or too narrow.
TradeStartHour and TradeEndHour are in broker server time, not your local time. Check your broker's server offset before setting the session window.
With DebugLog enabled, the Journal shows exactly why each bar did or did not produce a trade — arrow detection, trigger evaluation, which filter blocked an entry, and the result of every OrderSend . Turn it off for long optimisation runs.
This EA is published as a working, readable starting point rather than a finished commercial system. It ships with no optimised parameter set, and the defaults are sensible starting values, not tested edges.
Test it in the Strategy Tester on your own broker's data and then forward-test on a demo account before risking real capital. Results vary considerably between brokers because of differences in spread, swap, quote precision and server time. A reversal system of this type will naturally underperform during strong sustained trends, when colour flips generate repeated counter-trend entries — the channel trigger reduces this but does not eliminate it.
Feedback and improvements are welcome.
All signal logic in this EA is original and built from publicly documented techniques: Heikin-Ashi bar averaging and a Keltner-style EMA/ATR channel. It is not derived from, and does not reproduce, any commercial or licence-protected indicator. The EA has no external indicator dependencies and calls no DLLs.
Supertrend MTF Indicator
Free multi-timeframe Supertrend indicator for MetaTrader 4 with clear trend lines and Buy/Sell signal arrows.
H1 Container MTF Boxes
Visual MT4 indicator that draws the current or selected H1 range and nested M30, M15, M5 and M1 boxes. An EA based on this logic is in development.
Semi-HFT Grid Bot Two-sided seed-bump-martingale grid with basket take profit
A two-sided grid EA that lays a small symmetric ladder of pending stop orders around the current price, then escalates in two stages as fills accumulate: first a single opposite-side lot "bump," then a full martingale doubling sequence with two extra grid levels added. The whole basket is watched as one unit and closed the moment its combined floating profit reaches a target, after which a fresh grid re-arms automatically. Built with separate, auto-selected input profiles for XAUUSD and NAS100/US100, since the two symbols need very different lot sizes, grid spacing, and broker minimum-distance handling.
MD Scalper HFT – Trend / Reversal pending-stop scalper with trailing stop
Scalping Expert Advisor that reads a 3-period smoothed MA channel (High/Low), places pending stop orders either with the move (Trend) or behind it (Reversal), and trails the stop loss tick by tick. It includes broker-safe order handling for stop level, freeze level, retries and latency.(Inspired by Waygrow Ea)