I would like to calculate the number of ticks (or alternatively the price change) per second. Unfortunately MQL5's ENUM_TIMEFRAMES only goes down to 1 min. This indicator proves it's possible, though, but how? Maybe by means of the OnTimer event?
Many thanks for your answers!
datetime
time is number of seconds since the new computer era. if you callTimeCurrent()
that returnsdatetime
, it will give you integer. if you call it again in 0.1 second, you will receive same integer (or same+1). The indicator may count number of ticks in OnCalculate() and comparing with old time. something like this:if necessary, add
ticksLastSecond
in an array to average over last minute or any other period