Forex
EA

EA: Ichimoku Breakout Expert Advisor

Last updated 2026-07-17

An Expert Advisor (EA) is different from every other download on this site — an indicator only plots or alerts, while an EA actually sends orders on your behalf. 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.
  • RiskRewardRatio (default 2.0) — Take Profit distance = Stop Loss distance (from Kijun-sen) × this ratio.
  • RiskPercent (default 1.0) — percentage of account balance risked per trade, used to calculate lot size against the Kijun-sen-based Stop Loss distance. Ignored if UseFixedLot is enabled.
  • UseFixedLot (default false) — when enabled, trades a constant lot size instead of calculating one from RiskPercent.
  • FixedLotSize (default 0.01) — the lot size used when UseFixedLot is enabled.
  • MaxSpreadPoints (default 30) — skips new entries while the spread is wider than this, the same concern covered in Spread and Slippage.
  • EnableTrading — a master on/off switch, useful for pausing the EA without removing it from the chart.
  • MagicNumber (default 20260726) — tags every order this EA places so its position-counting and management logic never touches trades opened manually or by a different EA.

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.

Installation and Setup

EAs install into a different folder than indicators — this is the step people miss most often.

  1. Download the file below for your platform.
  2. Open MetaTrader → click FileOpen Data Folder.
  3. Place the file in MQL4/Experts (MetaTrader 4) or MQL5/Experts (MetaTrader 5) — not the Indicators folder.
  4. Restart MetaTrader, then drag the EA from the Navigator window onto a chart.
  5. Enable AutoTrading (MT4) or Algo Trading (MT5) in the toolbar — the EA will not place any trades while this is off, even if it's attached to a chart.
  6. Review and adjust the input parameters in the EA's settings dialog before confirming.

A Word of Caution

Test on a demo account first, across different market conditions, before risking real money — past performance, in backtests or live, never guarantees future results. No strategy, automated or manual, wins every trade, and this EA can and will lose money on individual 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 files are source code — open and review them fully, and understand what every parameter does, before using it. This content is general education, not personalized investment advice.

Download the EA

How to Install — MetaTrader 4

  1. Download the ichimoku-breakout-ea.mq4 file below.
  2. Open MetaTrader 4 → click FileOpen Data Folder.
  3. Place the file in the MQL4/Experts folder.
  4. Restart MetaTrader 4, then drag the EA from the Navigator window onto the chart.

How to Install — MetaTrader 5

  1. Download the ichimoku-breakout-ea.mq5 file below.
  2. Open MetaTrader 5 → click FileOpen Data Folder.
  3. Place the file in the MQL5/Experts folder.
  4. Restart MetaTrader 5, then drag the EA from the Navigator window onto the chart.

Both files are source code — open and review the full code before using it, for your own safety.

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