RequestTimedRefresh
- forces periodical refresh of indicator pane

Indicators
(AFL 2.90)


SYNTAX RequestTimedRefresh( interval, onlyvisible = True )
RETURNS NOTHING
FUNCTION The function causes given indicator window to refresh automatically every seconds regardless of data source used or connection state.

interval parameter defines timeout in seconds between refreshes. AmiBroker attempts to align refreshes to second boundaryso if you call it RequestTimedRefresh( 5 ) you should get refreshes at 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 and 55 second of the minute.Due to the way how regular (low overhead) timers are implemented in Windows they have accurracy of +/-55ms providedthat CPU is not very busy. Don't expect to get first line of your code to execute exactly at .000 milliseconds. This varies depending on machine load, number of quotes, system time slice and tens of other factors.Usually (on my testing machines) the first line of the code executes anywhere in the first 100 ms of the second, provided that other processes do not interfere. Windows is not real-time operating system and it does not guarantee any fixed execution/reaction times.

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.

Hint: to detect whenever given refresh comes from timer or user action you can use Status("redrawaction") function. It returns 0 for regular refresh (user action) and 1 for timer-refresh

Starting from version 5.30.3 RequestTimedRefresh supports sub-second (down to 0.1 sec) resolution, when enabled via registry setting (HKCU/Software/TJP/Broker/Settings/EnableHiresRTR, DWORD value = 1 )

EXAMPLE RequestTimedRefresh( 5 );
// automatically refresh this particular chart every 5 seconds
SEE ALSO STATUS() function

References:

The RequestTimedRefresh function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference