This function and this indicator count the second before the closure of the bar, and consequently emulate the countdown timer of MultiCharts.
It works with seconds, minutes or hours time-charts.
It could be used, for example, in order to do something 15 seconds before the closure of each 1-minute bar.
CRUCIAL WARNING: Multicharts built-in countdown timer is updated at each second. However, the present function and indicator are updated at each tick (and not at each second). So, if there are not a lot of transactions (a new tick each few seconds and not several ticks per second), there is a risk that the countdown does not work fluidly and reliably.
Function SecondsBeforeNextBar
It returns the remaining seconds before the closure of the bar or -1 in case of problem.
It also returns -1 while the first bar is on-going.
How does it work? When a new bar begins, the function takes note of the hour of the computer. Then, at each ticks, it reads again the current time of the computer, and compare it to the noted time (of the computer) at the beginning of the bar, and to the overall number of seconds per bar.
Indicator DisplaySecondsBeforeNextBar
It emulates MultiCharts built-in countdown timer. See snapshot.
Do not forget to tick Properties / Update on every tick in MultiCharts for this indicator.
Related discussion thread: https://nexusfi.com/elite-circle/17714-multicharts-indicator-number-seconds-before-next-bar-timer-countdown.html
Category The Elite Circle
|
|
|