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.
Thank you
Pongthorn
Cougar
October 23, 2019, 3:48pm
2
Quoting from a KB - When and how often AFL code is executed? :
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 .
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).
It is also possible to force certain refresh rate using dedicated RequestTimedRefresh() function in the AFL code: http://www.amibroker.com/f?RequestTimedRefresh
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:
Text - (affirmations in this case) moving across the screen looks nice, but the chart needs to be refreshed frequently to achieve a smooth move. The more refreshes per second, the better it looks. Lots of refreshes causes lots of processor overhead. If the main formula is simple, that may not be a big problem (nevertheless unnecessary refreshes should always be avoided), but if you force AmiBroker to unnecessary refresh 10 times per second a complex formula (only to display a simp…
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
Tomasz
October 24, 2019, 6:02am
3
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 .