Program pauses when Amibroker minimized


#1

Hi there,

I wrote an AFL program to record the OHLC every 5 seconds. It pauses when Amibroker is minimized, and starts recording again when Amibroker window returns normal. I hook this program by using the "Apply Indicator" in AFL editor. Same problem occurs for my auto-trading program.

Any solution to this? I am new in Amibroker.

Thanks

Thomas


#2

This is normal behaviour to conserve PC's resources. Typically if you minimize AmiBroker or some charts, there's no need to refresh them because they are not visible. If you want to keep executing some AFLs when AmiBroker is minimized you can:

  • Use Automatic Analysis Window (instead of charts) and its Auto-repeat option

  • If you want to use charts, use RequestTimedRefresh( interval, onlyvisible=False ) with the last parameter onlyvisible set to False

A quote from: http://www.amibroker.com/guide/afl/requesttimedrefresh.html

Onlyvisible parameter set to True (default value) means that refreshes are triggered only for visible and not minimised windows. This applies also to main AmiBroker window - when it is minimised charts are NOT refreshed by default. To force refreshes when window is minimised you need to set this parameter to False. Note that this visibility applies to mostly to 'minimised' state or the situation when you move chart outside the boundary of physical screen so it is not visible to an eye but still open. It does not apply to chart windows that are on placed on inactive sheets, as they do not really exist until they are shown (this way AmiBroker conserves memory and CPU) and as non-existing, can not be refreshed.

Read this article: http://www.amibroker.com/kb/2015/02/03/when-and-how-often-afl-code-is-executed/

And you might be also interested in some examples and additional info regarding using RequestTimedRefresh() in this thread:

... or these:

Regards


#3

It works!! Thanks for quick and detail response.