Running Amibroker 6.30.5 Professional Edition 64 bit licensed version.
I trade on 5 min interval and I have set my database Base time interval as 1 minute.
In order to ensure tick data is fetched from the plugin for all the 81 symbols and updated into the database, I have automated a simple screener (using Analysis explore OLE object) to be run separately every 30 Secs. I have enabled - wait for Backfill for this explore.
The screener (Analysis explore on 1 minute timeframe) runs at 1st Second of a minute and 30th Second of the minute. I have presumed here that frequent scan/explore will enable periodic fetching of RT data and updating into database instead of fetching/updating it in bulk at the start of the 5 minute timeframe.
In order to measure how many seconds (after the start of the minute) it takes to update the database fully for all 81 symbols, I ran scans (1s 3s, 5s, 7s) and found out it takes a minimum of 3 secs and maximum of 7 secs to fully update past candle information for all symbols and the time delay varies depending on the data volume/market timings.
Screenshots below depicts scan state at 1 second, 3 second 5 second and 7 second after the minute. Notice the symbols that show wrong previous bar timestamp at the top and this list gradually reduces and the scan at 7th second shows all symbols with the last ‘minute candle’ fully updated/completed and the previous bar and current bar timestamp aligns with the current time.
Exploration at 1st second (run @ 15:25:01:007): Almost all symbols are still showing close price of last but one minute (15:23:59). I’ve highlighted the timestamp (15:25:01:007)on the auto screener batch command window for reference.
Exploration at 3rd second (run @ 15:25:03:571): Almost 10% of the symbols are still showing close price of last but one minute (15:23:59).
Exploration at 5th second (run @ 15:25:05:180): Atleast 2 ( to 4) symbols are still showing close price of last but one minute (15:23:59).
At the completion of 7th second (after the minute) all the symbols get updated and show the close price of the last completed candle (in this case (15:24:59).
I have referred to this post, which addresses most of the questions related RT data feed, thanks to @term, @milosz, @sean and of course @Tomasz.
I have referred to other posts on this subject as well but couldn’t find a direct solution. Maybe I missed something.
I have RT subscription for 225 Symbols.
I have added the 81 Symbols in RT quote window and I can see it updates the data/quote columns for every tick that it receives for every symbol.
My screener exploration runs well within 0.15 seconds on average.
I don’t open any charts during market hours.
I'm running Amibroker on dedicated internet with almost no packet drops and minimum latency.
My 1500 line inefficient code (Strategies + Trading system) takes less than 3 seconds for backtesting for almost 1 year data of 81 symbols on 5 min timeframe. Thanks to superfast AmiBroker.
But the tick data append to the database from the plugin for 1 recent bar takes 3 to 6 secs for the same 81 symbols.
I believe I’m missing some setting that's causing this delay. Or maybe the plugin is not feeding the data fast enough for the data append call from Amibroker.
(And the reason for me posting this post is my earlier post which was the actual impact I faced, ie., delayed Buy Signals, because of the candle formation issue.
Buy signal missed/delay because of candle formation delay )
I guess I dint ask the right question in that post and just simply detailed my issue and understanding.
So I have attempted to ask the right question.
How to speedup candle formation/completion from RT plugin streaming data?
Has anyone faced such an issue? Any settings/solution that could help speed up the process?
Any other thoughts/inputs are welcome.
Thanks,
Karthik P