![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
A small summary of the experiments with tick analysis.
1. the OnTick handler skips a significant number of ticks.
Therefore, if you want to analyze the strip of deals through the incoming tick, it makes no sense.
With this approach, the results of the algorithm in the tester and the real trading results will be different.
As an alternative, you can analyze the strip of deals for a selected period or a certain amount of last deals by obtaining the history ticks using the CopyTicks() or CopyTicksRange() functions.
In this case, the results of testing the algorithm in the tester and the real trade results are the same.
The disadvantages are lower performance of the algorithm.
Yes, the Expert Advisor may miss ticks. Therefore, it is either the indicator or CopyTicks.
And the performance degradation due to what? Copy only the required segment (that has appeared since the last successful data retrieval).
Why collect them "in real time" if CopyTicks is used anyway?
You can copy the ticks to the right depth at any time you want.
Andrew, read the title of the topic
Added
You can't get it to the right depth with CopyTicks(), it's only 2000 ticks!
Andrei, read the title of the topic
What of the fact that the task is originally set incorrectly?
The analysis of ticks in real time is possible, but it's necessary to use indicator or CopyTicks to avoid gaps.
You can't get the required depth with CopyTicks(), but only 2000 ticks!
There is no such limitation, see example from documentation:
What of the fact that the task is originally set incorrectly?
Real-time ticks analysis is possible, but you have to use an indicator or CopyTicks to ensure there are no omissions.
There is no such limitation, see example from documentation:
1. Not necessarily an indicator!
If you mean the help, which says
In Expert Advisors and scripts, the CopyTicks() function can wait up to 45 seconds....
If you read to the end, it says
Output speed: the terminal stores for each character 4096 last ticks in the cache for quick access (65536 ticks for characters with the stack running ), queries to this data are the fastest.
The OnBookEvent() event is triggered when a new pack of ticks arrives to the terminal, therefore
it's possible to collect ticks from the Expert Advisor. Take an example and check it.
2. There is such limitation, check it yourself(CopyTicksRange() has no limitation)
1. Not necessarily an indicator!
The OnBookEvent() event is triggered when a new package of ticks arrives in the terminal, so
it is possible to collect ticks from the Expert Advisor. Take an example and check it out.
OnBookEvent doesn't guarantee that the ticks won't be missed. If there are heavy calculations there, there will be the same skip as in OnTick.
And it doesn't matter where to copy the necessary depth of ticks from via CopyTicks.
2. There is such limitation, check it yourself
It exists just for parameters 0, 0, which is explicitly mentioned in the help:
Если параметры from и count не указаны, то в массив ticks_array[] будут записаны все доступные последние тики, но не более 2000.
OnBookEvent makes no guarantees that the ticks will not be missed.
I repeat
OnBookEvent() precisely gives that guarantee that a new batch of ticks has arrived!
From the reference:
Issuance rate: The terminal stores for each character 4096 last ticks in the quick access cache (for characterswith the stack running, 65536 ticks), queries to this data arethe fastest.
End of quote----
If OnBookEvent wasn't triggered, all trading (exchange) in MT5 could be thrown in the trash!
New pack of ticks arrived - 100% triggered OnBookEvent, and the CopyTicks() shows how many ticks arrived,
data already stored in cache and it's the fastest access!
That's why the collector of ticks can be implemented in real time in indicator and EA(when the market is running).
Added by
Take the code above and check it, than argue...
The tick collector code is correct, but there are some implementation errors.
and post it later.
Added
Collector of all ticks in real time from Expert Advisor
Please use
To compare how the ticks collector works, you can make a Ribbon of all trades from it at one point
(by replacing COPY_TICKS_ALL with COPY_TICKS_TRADE in two places) and compare it with the Ribbon of deals,
embedded in the instrument glass.
If the instrument is highly liquid, the prints may go with a long delay
Can't ticks have more than one flag at a time?
Repeat
OnBookEvent() is exactly the kind of guarantee that a new batch of tickshas arrived!
But does that mean that there is a guarantee that you will handle ALL OnBookEvent events?