You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I myself use also the iTime comparison. So far it works nicely but I still don´t know if iTime technically only transmits time comparisons or if it is somehow synchronized with new tick event or/and trading server also.
Seems OnTick event triggers iTime newbar even after bar forming time.
OnTick event + iTime() does not align perfectly with the clock—it aligns with when the first tick of the new bar arrives. As mentioned above, if the market is quiet, this could be delayed by seconds or even minutes, especially on higher timeframes or during low-liquidity sessions.
But what about using the TimeCurrent() function, does it work the same way when we used it in the OnTick function? I believe I'm not the only one who has used such logic and so far but hasn't thought about how it actually works.
Maybe someone could explain it technically?
I think TimeCurrent() will work together using OnTimer() / OnTimer Event. This will more precise, but slightly more complex.
OnTick event + iTime() does not align perfectly with the clock—it aligns with when the first tick of the new bar arrives. As mentioned above, if the market is quiet, this could be delayed by seconds or even minutes, especially on higher timeframes or during low-liquidity sessions.
I think TimeCurrent() will work together using OnTimer() / OnTimer Event. This will more precise, but slightly more complex.
That's how I understand it, that's exactly what I thought, and that's why I raised this question, how can TimeCurrent() be the trigger for an iterator that needs to read new bars? But maybe there's something here that we don't know, because the mql5 gurus emphasize the importance of time and I still don't understand why? There is possibility that maybe still TimeCurrent act exact the same way when we call it inside OnTick instead of OnTimer? There is maybe some Built-in methods to sync such data...i don´t really know, because i do not use the time itself without new bar as iterator controller of my logics.
But when we analyze this a bit, there arises the inverse question. Why call the TimeCurrent() function inside the OnTick() function?
Here is actually a simple explanation... When we call the TimeCurrent() function inside the OnTick() function instead of OnTimer, then the threshold time of the function built on CurrentTime() expires and the function returns TRUE. Now it cannot realize its TRUE status until a new tick has appeared. Now it doesn't matter what time it is, the final state of our function is still TRUE and it will be executed at the first opportunity, i.e. when a new tick event occurs.
Now, when a new tick arrives, TRUE is executed and the function status is set again to FALSE.
So, there is a very simple piece of logic written here where executing TRUE triggers a FALSE status. Therefore, new FALSE cannot occur until a new tick arrives and the function is executed.
This creates the desired delay without any additional methods. I believe that is how it works and it is actually that simple it is. As most things which seems very complicated are actually very simple. Therefore it seems that TimeCurrect() based solution is still an authentic if it is called inside OnTick. Simpe as that. I'm ashamed now that I even raised such a question before. Think before you speak didn't apply at all :D