How to Set RequestTimedRefresh() every minute instead of second

Hi

If I prefer to set the RequestTimedRefresh method in order to refresh every 1, 5 or even 15 minutes instead second.

RequestTimedRefresh( interval, onlyvisible = True )

For the interval parameter, is it supported? such as 15 minutes
RequestTimedRefresh( 900);
I place it on the first line in code.
am-refresh

Thank you

Pongthorn

Quoting from a KB - When and how often AFL code is executed?:

  1. In a local database, which is not updated by a realtime plugin, the formula would get refreshed if we perform any actions, such as clicking, scrolling, zooming, changing parameters, choosing another symbol or interval, importing new data etc.
  2. In addition to the actions listed in (1), if we are running a plugin-based realtime feed, then the chart is refreshed based on “Intraday refresh interval” defined in Tools –> Preferences –> Intraday. If we enter 0 into this field, then it will result in chart being refreshed with every new tick (up to 10-times per sec).
  3. It is also possible to force certain refresh rate using dedicated RequestTimedRefresh() function in the AFL code: http://www.amibroker.com/f?RequestTimedRefresh
  4. It is also possible to manually refresh chart (or all chart and windows) using View->Refresh (or View->Refresh All ) menu.

Any of the events as underlined above shall refresh your charts anyways. So, it is of no use if you:

You have not shared your clear intentions. See GetPerformanceCounter or ThreadSleep if you may.

One beautiful example of GetPerformanceCounter() usage:

But why stop refreshing charts for such a long-time? Anyways, such actions are not recommended and/or advanced, please handle with care!

3 Likes

Obviously 1 minute has 60 seconds, so:

RequestTimedRefresh( 15 * 60 ); // timed refresh every 15 minutes

But as @Cougar quoted KB article, charts are refreshed automatically on other occasions too.