Is it possible to work with live ticks in MQL5 indicators? - page 2

You are missing trading opportunities:
- Free trading apps
- Free Forex VPS for 24 hours
- 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 have already given you an example of just that, from the CodeBase, in my post #6.
That CodeBase publication serves as an example for both "live" and/or historical tick data. The process is the similar.
I guess this is it then, it's complicated, but I guess this is the way to go about it in mql5. I couldn't find something like that, so thanks for posting
No, I did not say that it does not "skip" ticks. That is incorrect. What I said was that it processes "tick events".
It processes ticks in the same way as OnTick() and It DOES SKIP ticks if the processing takes too long.
Are you sure OnCalculate() skips ticks??
EDIT:
As far as I have experienced, it does not skip ticks....
It was a long time ago when I experimented. However, since MetaTrader has evolved a lot, I may be wrong now. I will have to test it again.
Also, when the OnCalculate() takes too long to process, MetaTrader logs a warning to the Experts log.
Are you sure OnCalculate() skips ticks??
EDIT:
As far as I have experienced, it does not skip ticks....
To check need use CopyTicks in OnCalculate to know how many ticks has arrived since the last call.
Also the result will depends on the liquidity of the symbol, as in some markets and symbol we may have tens of ticks every milisecond while in others just feel ticks by minute.
See documentation.
A program gets events only from the chart it is running on. All events are handled one after another in the order of their receipt. If the queue already contains the NewTick event or this event is in the processing stage, then the new NewTick event is not added to mql5 application queue.
It was a long time ago when I experimented. However, since MetaTrader has evolved a lot, I may be wrong now. I will have to test it again.
Also, when the OnCalculate() takes too long to process, MetaTrader logs a warning to the Experts log.
The purpose of this function is work with the data passed in the parameters, which are ohlc bars, not tick data.
To check need use CopyTicks in OnCalculate to know how many ticks has arrived since the last call.
Also the result will depends on the liquidity of the symbol, as in some markets and symbol we may have tens of ticks every milisecond while in others just feel ticks by minute.
See documentation.
A program gets events only from the chart it is running on. All events are handled one after another in the order of their receipt. If the queue already contains the NewTick event or this event is in the processing stage, then the new NewTick event is not added to mql5 application queue.
If it is indeed the case that OnCalculate gets called for EVERY tick, then that would mean that during high volatility, the indicators (which share a single thread with the chart itself), can easily "stall" that thread and "freeze" the chart completely. That seems somewhat "dangerous".
EDIT: The documentation does in fact state ....
So, it could be interpreted the way you describe, and it would explain why charts tend to stall a lot during high impact news.
I sure hope that is not the case, however. If it is, it may make me want to rethink some of my EAs and have them recalculate everything internally without using Indicators.
If it is indeed the case that OnCalculate gets called for EVERY tick, then that would mean that during high volatility, the indicators (which share a single thread with the chart itself), can easily "stall" that thread and "freeze" the chart completely. That seems somewhat "dangerous".
I was to say that, but i though the documentation was enough to proof the point when it says " If the queue already contains the NewTick event or this event is in the processing stage, then the new NewTick event is not added to mql5 application queue. "