Buy signal missed/delay because of candle formation delay

Running Amibroker 6.30.5 Professional Edition 64 bit licensed version.

I use Analysis Scan option (1 recent bar) to initiate Live Auto Trade based on signals from a strategy across 100 Symbols.

I have automated to run the scan 2 secs past every minute, using a java script (using OLE object for Analysis doc object). (with - wait for Backfill - disabled)

The time frame I trade is 5 min candle.

In order to ensure tick data is fetched from the plugin for all the 100 symbols, I have automated a simple screener (using Analysis explore OLE object) to be run separately every 30 Secs that completes just before the Live Trade scan begins. I have enabled - wait for Backfill - for this explore.

(without the above screener/explore I have noticed that actual live auto trade scan takes, few 100 milliseconds or even a second, more to complete).

Most of the order gets placed within milliseconds or max within a second.

But at times (1 in 10 ) 1 or 2 symbols/orders doesn’t get placed at the start of the 5 min candle (eg., 9:20). Instead it gets placed at the start of the next 1 min (eg., 9:21).

And I have confirmed this visually - it doesn’t list in the Auto scan results list at start of 5 min candle but gets listed at the next 1 min scan.

E.g., 7 orders get placed at 9:20:02 (~03), but 1 order gets placed at 9:21:02(~03).

Attached screenshot from broker page: The marked order at 9:21:02 should have been placed at 9:20:02 (~3).

The above issue is random and doesn’t depend on symbol/timing/broker etc.,

I have noticed that the missing symbol indeed appears with Buy signal in the backtest (1 recent day) which I run manually any time between 9:20 and before 9:21.

I have not included the actual strategy but just to mention I have included trade delay with ref(buy, -1) and order gets placed at start of the next candle after actual buy candle.

I do not use CBT yet.

My afl (strategy and order placing module) scan takes less than 2 Seconds to run for 100 symbols. Thanks to Super Fast Amibroker!

My afl doesn't reference future quotes.

I’m wondering if the issue pertains to 5min candle not forming fully for that specific symbol at the time of running the scan (2 secs after the minute).

I have tried increasing the wait time to 3 secs (after the minute) before the scan starts. That seems to alleviate the problem but couldn’t confirm as the issue is random.

I don’t want to increase the delay to more than 3 secs as that would affect my entry/exit price.

I am thinking of running the scan twice back to back (with a small 500 ms delay) for every minute. Assuming this would give enough time for incoming data to complete the 5 min candle formation for all symbols and the scan can generate the signal atleast in the second run if not the first for the missed symbols. Atleast then there will be not be a 1 min delay in order placement for those symbols/instances.

I'm running Amiborker on dedicated internet with almost no packet drops and minimum latency.

(The Base time interval for by database is 1 min)

Has anyone faced such an issue? Could someone help confirm if my understanding of incoming RT data -> candle formation is correct i.e., candle formation depends on tick data arrival at the plugin and delayed tick for a symbol can affect the past 5 min candle properties well into the next candle.

Any other thoughts/inputs/suggestions to overcome the issue is welcome.
Please let me know if more information is needed to dig deeper.

Karthik P


For anyone facing similar problem, the solution would be to get a Real-Time data provider that is fast enough for your trading system/time-frame.

In my case the RT Plugin causes delay in data refresh/backfill that results in delayed/missed signals.
Reference post on this subject:
ref post

Karthik P

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.