how to calculate/update my indicator every 5 seconds?

 
I am learning programming in MT4. How can I calculate my indicator only
after the lastest bar has been shown on the chart and how can I update
the indicator at least after 5 seconds or at the beginning of a new bar
is generated thereafter? Any help is greatly appreciated.

BTW, my indicator is a modified zigzag indicator and which only
requires updates sporadically.
 
Indicator calculated with every incoming tick, with refresh chart data, with change symbol/period