Auto execution of formula and timing question



I’m trying to setup a AFL formula to execute for automated trading with IB. As far as I have understood, the best option is to use the Analyzers Exploration function to execute the formula based the time interval setting in Auto Repeat A/R Scan/Explore.

I’m curious to know if this is a robust solution. If I have understood this right, the AR explorer is executing like a timer. For example every 5 minutes if i would like to trade 5 min bars. But what if the data source haven’t received any new bar at the exact same time the Explorer is executing? Imagine the explorer executes at time X, and a new bar is received from the data source at X±200 ms. This would make the formula execution and the incoming data out of sync, and therefore a proper trading decision cannot be made. How do we handle such problems? Is the Explorer the right solution for auto trading?

Another question about the periodicity. When running the explorer, how does it know which time frame that it should execute on? For example if I have a database consisting of 1 minute bars and the explorer is executing on symbols from that same database, defined by the analyzer filter. Where is the time period set is it set? Is it set in the Back tester settings or elsewhere?



I have the same question.
I think the solution is to set exploration refresh time to be very short, like 10 secs or 15 secs.

But how to handle redundant signals?
Is there any way to store the last bar time with symbol name at end of exploration to know if such signal is already pushed for trading in previous refresh??


I explained a couple of times that Windows is NOT real-time operating system. Only real-time operating systems guarantee fixed response times to events. Any program under control of Windows does NOT guarantee fixed response times as Windows may for example start swapping or do whatever it wants and pre-empt your app for indefinite amount of time.

Having said that auto-repeat just uses Windows timer. The execution of auto-repeat does not depend on data. It just runs when scheduled time arrives. Does not matter when / if your external source updated.

Time frame is of course controlled by SETTINGS in Analysis window. You just pick PERIODICITY to whatever you want. Reading the manual is recommended. Really everything is there

Entire tutorial is must-read


Can I also ask even if the OS was real-time. Amibroker doesn’t allow for real time trading since it does not have an event handler? And fastest execution is permitted by the platform is 1 second (Chart auto-refresh rate & Auto-run exploration).


You are so unbeliveably wrong.
How come that noobs like you speak up on things they have NO IDEA about.

AmiBroker HAS EVENT HANDLER as any Windows program.
If you knew ANYTHING about Windows programming you would know that ANY windows program (except CONSOLE programs) MUST have an event handler.

Buy some books and educate yourself before speaking up.

Also if you ever READ the AmiBroker Development Kit you would see that plugins send a WINDOWS MESSAGE (WM_USER_STREAMING_UPDATE) when new quote arrives. And that message reaches the MESSAGE HANDER inside AmIBroker.
That event handler among other things updates Time&Sales window, Real Time Quote window and charts.
Refreshes are done asynchronously (in separate threads) and depending on your formula speed can execute your code even 10 times per second or more. The 1 second refresh interval you are talking about is “LAZY REFRESH” in case of NO QUOTE UPDATES arriving.

So, before speaking up next time get read some books and docs because you are making fool of yourself.