Advertisement IC Markets

Tick bursts and the cross your OnTick logic never saw

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Tick bursts and the cross your OnTick logic never saw

Post by Fairman »

Tick bursts and the cross your OnTick logic never saw

Here's a subtle one. Your EA checks for a condition on each tick, say price crossing above a level or a fast MA crossing a slow one. In fast markets, ticks can arrive in bursts, and the platform may not run OnTick for every single one. If the EA is still busy processing the last tick, new ticks can be skipped, and the EA only sees the latest price when it's free again.

So if your logic looks for the exact moment of a cross, by comparing the current value with the previous one it saw, it can miss it. Price went from below to above and back to below between two calls. On the chart the cross is there. The EA never saw it.

A few ways around it. Check the condition on closed bars instead of ticks, if the strategy allows. Use state, so the EA knows it was below and is now above, rather than needing to catch the exact tick. Or in MT5, look at the tick history between calls with CopyTicks if you really need every tick.

Also keep OnTick light. Heavy calculations or slow logging in there make skipped ticks more likely.

Test it. A cross that shows on the chart and didn't trigger is often this.
It’s Fairman :geek:
Recommended broker for automated trading & scalping IC Markets
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Tick bursts and the cross your OnTick logic never saw

Post by Fairman »

The strategy tester can hide this problem. In 'every tick' mode the tester calls OnTick for each generated tick and waits for it to finish, so nothing gets skipped. Live, the platform doesn't wait. That's one reason an EA can catch every signal in testing and miss some live. If live results show fewer trades than the backtest over the same period, comparing the signal times is a good first step. Usually you'll find the missed trades cluster around busy moments, like the London open or news, which fits the burst explanation. If they're spread evenly, look somewhere else, like a filter that behaves differently live.
It’s Fairman :geek:
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Tick bursts and the cross your OnTick logic never saw

Post by Fairman »

One more source of this is running many EAs or charts in the same terminal. They share resources, and a busy terminal processes ticks more slowly for everyone. If you have a lot open on a small VPS, the chance of missed ticks goes up during exactly the busy moments when signals tend to appear. Splitting EAs across terminals or trimming what's running can help more than tweaking the code. A simple test is to log a timestamp at the start of each OnTick call and see how big the gaps get during the London open. If you're seeing long gaps on a quiet VPS, the code itself is probably doing too much.
It’s Fairman :geek:
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Tick bursts and the cross your OnTick logic never saw

Post by Fairman »

One mitigation is to evaluate signals on bar close rather than on every tick. If the logic only checks crossovers once per bar, using closed bar values, it doesn't matter whether some ticks were skipped during the bar. The downside is a delay of up to one bar in entry. For many strategies on M5 or higher that's acceptable. On M1 it's more noticeable, but it removes a whole category of bugs related to tick handling. Bar close logic is also easier to backtest honestly, since the tester's tick generation matters less. It narrows the gap between test and live results, which is the whole point of testing in the first place.
It’s Fairman :geek:
FXS Prop Desk
Posts: 1689
Joined: Wed Oct 07, 2026 9:52 am

Re: Tick bursts and the cross your OnTick logic never saw

Post by FXS Prop Desk »

Missed ticks explain why some EAs miss crosses that are clearly visible on the chart afterwards. Checking conditions on the bar close instead of on each tick solves it for most strategies, at the cost of reacting a bit later.

For strategies that need intrabar signals, comparing the current price with the level and storing the previous state in a variable helps. If the state changed since the last check, the cross happened, even if the exact tick was missed.
FXS Official Team | The Idea Lab & Strategy
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Tick bursts and the cross your OnTick logic never saw

Post by Fairman »

Logging the time between ticks the EA actually processed can show how bad the problem is. If gaps of several seconds appear during busy periods, the EA is missing ticks. Comparing those gaps with the market's tick rate at the same time tells you whether the terminal is overloaded or the broker's feed is just slow. That helps decide whether to move to a faster VPS, reduce the number of charts, or simplify the code. Writing those gaps to a small log file, with the time of day, makes it easy to see whether the problem is constant or only shows up at the busiest moments like the London open or data releases.
It’s Fairman :geek:
Post Reply