LearnForexHub
EA

EA: Ichimoku Breakout Expert Advisor

Written by , Founder & EditorLast updated How we write and review lessons

Unlike the indicators on this site, which only draw on the chart or fire alerts, an Expert Advisor places real orders for you. This free EA trades a trend-following breakout strategy built entirely around Ichimoku: it enters when Tenkan-sen crosses Kijun-sen with price already outside the cloud, sizes its Stop Loss, Take Profit, and position automatically, and manages one position at a time. One thing sets it apart from most other EAs on this site: its Stop Loss isn't ATR-based at all — it's the Kijun-sen level itself, for reasons explained below.

How the Strategy Works

Ichimoku plots five lines, but this EA only needs three of them to generate a signal: Tenkan-sen, Kijun-sen, and the cloud (Kumo) formed between Senkou Span A and Senkou Span B. Tenkan-sen is the faster of the two mid-lines, averaging the 9-period high and low; Kijun-sen is the slower one, averaging the 26-period high and low. When Tenkan-sen crosses above Kijun-sen, that's a bullish "TK cross" — the same crossover idea the site's own Ichimoku lesson describes, functioning much like a fast/slow moving-average crossover but with a shorter lookback that reacts sooner.

A TK cross alone is a weak signal on its own — like any short-lookback crossover, it fires constantly in choppy conditions and produces a steady drip of false starts. This EA adds a second, mandatory condition on top of the cross: the close of the signal bar must already be outside the cloud — above the cloud's top edge for a bullish cross, below its bottom edge for a bearish one. The cloud is Ichimoku's own support/resistance zone, and requiring price to already be through it before accepting a TK cross filters out exactly the signals that matter least: a cross that happens while price is still tangled up inside a flat, uncertain cloud reflects a market with no clear directional bias yet, while a cross confirmed after price has already broken clear of the cloud reflects a market that has committed to a direction. The EA checks both conditions — the cross and the cloud position — on every completed bar, using the previous two closed bars to detect the cross and the last closed bar's close to check the cloud.

Stop Loss, Take Profit, and Position Sizing

PriceBUYStop Loss = Kijun-senTake Profit (TP)Cloud (Kumo)Tenkan-senKijun-sen
Entry conditions: BUY when price breaks above a bullish cloud with Tenkan-sen crossing above Kijun-sen — SELL on the mirrored break below a bearish cloud — the Kijun-sen line itself becomes the Stop Loss

This is the section that matters most for understanding this particular EA. Most other EAs on this site size their Stop Loss from ATR — a volatility-adaptive stop that widens on volatile pairs and tightens on calm ones. This EA does not do that, and it's not an oversight. Kijun-sen was already designed to function as a trend-following support/resistance level as part of the Ichimoku system itself — it's the 26-period midpoint that many Ichimoku traders already watch as the level price should hold above (in an uptrend) or below (in a downtrend) for the trend to remain intact. Layering ATR on top of a Kijun-sen-based system would be redundant: both are trying to answer the same question — how far away should my stop be, given the current state of the market? — and Kijun-sen already answers it directly, using the same indicator that produced the entry signal in the first place.

So when the EA opens a BUY on a bullish cross-and-breakout, the Stop Loss is placed exactly at the current Kijun-sen value — a level that sits below the entry price precisely because Kijun-sen is a lagging, smoothed measure of where the market has recently traded. The mirrored logic applies to a SELL: the Stop Loss sits at Kijun-sen above the entry price. Take Profit is then set at a multiple of that Stop Loss distance — RiskRewardRatio, default 2.0 — so a 2.0 setting means the target is twice as far from entry as the stop, keeping every trade's risk and reward in a fixed, known proportion regardless of how wide or narrow that particular Kijun-sen-based stop happens to be at the moment of entry.

Position size is calculated the same way as every other EA on this site: a RiskPercent of account balance (default 1.0%) divided by the Stop Loss distance, converted through the symbol's tick value and normalized to the broker's lot step — the exact worked-example method from Risk Management Basics. A wider Kijun-sen-based stop produces a smaller lot size, and a tighter one produces a larger lot size, so the dollar risk per trade stays consistent even though the stop distance itself varies from trade to trade depending on how far price has already extended from the base line. A UseFixedLot input with a FixedLotSize value is available as an escape hatch for traders who'd rather trade a constant lot size regardless of risk. There is also a built-in safety check: if the computed Stop Loss distance comes out to zero or negative (which can happen in unusual circumstances, such as price sitting exactly on Kijun-sen at the moment of the signal), the EA skips the trade entirely rather than opening a position with no meaningful stop.

Entry Conditions

  • BUY — Tenkan-sen crosses from at-or-below Kijun-sen to above it on a newly completed bar, and that same bar's close is above the top of the cloud (the higher of Senkou Span A and Senkou Span B). The Stop Loss is placed at the current Kijun-sen value.
  • SELL — Tenkan-sen crosses from at-or-above Kijun-sen to below it on a newly completed bar, and that same bar's close is below the bottom of the cloud (the lower of Senkou Span A and Senkou Span B). The Stop Loss is placed at the current Kijun-sen value.

The EA evaluates these conditions once per new bar only (tracked against the time of the current bar's open), never on every tick, so a single cross can't fire multiple trades within the same candle. It opens at most one position at a time, counted and filtered by its own magic number (MagicNumber, default 20260726), so it never confuses a position it opened with one you opened manually or one belonging to a different EA on the same account. Before opening anything, it also checks the current spread against MaxSpreadPoints and skips the entry entirely if the market is too illiquid at that moment. Finally, the degenerate-stop guard described above means a trade is only ever sent when the computed Stop Loss distance is a genuinely positive number — a signal that technically fires but produces a zero-distance stop is discarded rather than sent to the broker.

Parameters

  • TenkanSen (default 9) — the lookback period for the fast conversion line; controls how quickly the cross reacts to short-term price swings.
  • KijunSen (default 26) — the lookback period for the base line, which doubles as the Stop Loss level for every trade this EA opens. A longer period produces a slower-moving, more distant stop; a shorter one produces a tighter, faster-moving one.
  • SenkouSpanB (default 52) — the lookback period for the slower of the two cloud-forming lines, which together with Senkou Span A defines the cloud (Kumo) boundary the entry filter checks against.

The rest of the inputs belong to the shared risk engine every EA here uses: stop and target sizing, position sizing, the spread filter, and the master switch. They are documented once on the EA hub page rather than repeated on every lesson. Orders from this EA carry the magic number 20260726.

Notice what's missing compared to most of the site's other EAs: there is no ATRPeriod and no ATRMultiplier here. That's not a simplification or an oversight — it's the direct consequence of the design choice explained in the next section.

Why This EA Uses Kijun-sen Instead of ATR

Most other EAs on this site — ea-trend-following included — calculate their Stop Loss as ATRMultiplier × ATR, a fixed distance recalculated fresh at the moment each trade opens. This EA works differently on purpose, the same way Parabolic SAR Trend EA does, and the reasoning is worth walking through concretely.

ATR measures average volatility over a lookback period and gives you one number: how far away, in current market conditions, a stop "should" be at this instant. It has no opinion about trend structure — it's purely a volatility gauge, blind to where support and resistance actually sit. Kijun-sen is a different kind of number entirely: it's the midpoint of the 26-period high-low range, which makes it a genuine trend-following level baked into the Ichimoku system's own design, not a distance derived from volatility statistics. In an established uptrend, price tends to pull back toward Kijun-sen and hold above it repeatedly; a decisive close below it is a real structural signal that the trend has likely broken, not just a volatility-scaled guess at where a stop "should" be.

That's the practical implication for this specific EA: because the entry signal itself — the TK cross — is generated from Tenkan-sen and Kijun-sen, using Kijun-sen again as the Stop Loss means the stop is drawn from the exact same indicator, on the exact same chart, that produced the trade in the first place. There's no second calculation to keep in sync, no separate volatility window to configure, and no risk of the ATR-based stop and the Ichimoku-based entry disagreeing about how the market is currently behaving. Running ATR alongside Kijun-sen here wouldn't make the stop meaningfully better — Kijun-sen is already a support/resistance level derived from real price structure, which is a stronger foundation for a trend-following stop than a volatility multiple that has no awareness of where the market has actually been trading. Adding ATR on top would just be a second, disagreeing opinion on a question Kijun-sen has already answered using the same data the entry signal itself relies on.

A Word of Caution

Run it on a demo account first, through different market conditions, before real money is involved; past results, whether from backtests or live trading, guarantee nothing about the future. There is no rule set, manual or robotic, that avoids losses — this EA will have losing trades. Breakout and trend-following EAs like this one whipsaw in choppy or ranging markets: a TK cross can occur right at the edge of a thin, flat cloud, and price can slip just barely outside the cloud boundary only to reverse straight back through it a few bars later, generating a loss before any real trend developed. Consider combining it with a read of trend vs range before enabling it on a live account, and pay attention to how thick or thin the cloud is at the moment a signal fires — a thin, twisting cloud is exactly the condition most likely to produce a false breakout. Both downloads are plain source files — read them end to end and make sure you understand each input before trusting them with an order. This page teaches how the mechanism works — it is not a recommendation to trade it with real money.

Download ichimoku-breakout-ea.mq4

For MetaTrader 4 — this is source code (.mq4), open and review it fully before using it.

Download File

Download ichimoku-breakout-ea.mq5

For MetaTrader 5 — this is source code (.mq5), open and review it fully before using it.

Download File

How to install

An EA installs into the Experts folder, not Indicators — this is the step people miss most often.

MetaTrader 4

  1. Download ichimoku-breakout-ea.mq4 above.
  2. Open MetaTrader 4FileOpen Data Folder.
  3. Place the file in the MQL4/Experts folder.
  4. Restart MetaTrader 4, then drag it from the Navigator window onto a chart.
  5. Enable AutoTrading (MT4) or Algo Trading (MT5) in the toolbar — the EA places no trades while this is off, even when attached to a chart.
  6. Review and adjust the input parameters in the settings dialog before confirming.

MetaTrader 5

  1. Download ichimoku-breakout-ea.mq5 above.
  2. Open MetaTrader 5FileOpen Data Folder.
  3. Place the file in the MQL5/Experts folder.
  4. Restart MetaTrader 5, then drag it from the Navigator window onto a chart.
  5. Enable AutoTrading (MT4) or Algo Trading (MT5) in the toolbar — the EA places no trades while this is off, even when attached to a chart.
  6. Review and adjust the input parameters in the settings dialog before confirming.

Both files are source code. Open and read them in MetaEditor before running them on any account.