Features of the mql4 language, subtleties and techniques - page 31

 
Vladimir Pastushak:

It doesn't work...

The possibilities of the language have been cut.

 
Could you please tell me if IsStopped() function, when a trader stops working, immediately interrupts the work of the EA at the place where the flag status is checked, or will the EA finish the tick (in the absence of other events), like in function ExpertRemove() and stop only when a new tick comes?
 

Good afternoon!

In the indicator prev_calculated often becomes zero, due to which the indicator is often recalculated, which is not necessary. I am interested only in the last 500 candlesticks, if there is no history changing or new candlesticks coming in.
Please advise the best option. Maybe we should make a time array of each candlestick and check it via a loop? Or there are other variants?

 
Nauris Zukas:

Good afternoon!

In the indicator prev_calculated often becomes zero, due to which the indicator is often recalculated, which is not necessary. I am interested only in the last 500 candlesticks, if there is no history changing or new candlesticks coming in.
Please advise the best option. Maybe we should make a time array of each candlestick and check it via a loop? Or there are other variants?

We can try to calculate some hash for these candlesticks and compare it.
But it will change with each candlestick, so maybe the array-cache will be a better solution.

 
Vladimir Pastushak:
I'm looking formethods to sort an array of structures. Does anyone have any working variants ?

Here

Особенности языка mql5, тонкости и приёмы работы
Особенности языка mql5, тонкости и приёмы работы
  • 2020.05.25
  • www.mql5.com
В данной теме будут обсуждаться недокументированные приёмы работы с языком mql5, примеры решения тех, или иных задач...
 
Andrey Khatimlianskii:

You could try to calculate some hash for these candlesticks, and compare it.
But it will change with each candlestick, so maybe an array-cache would be a better solution.

If you have inserted or deleted a bar, it will work, but if you have corrected the shadows, no, in the last case there is no quick solution at all. 500 bars is not the right amount of hash for it.
 
TheXpert:
If you inserted or deleted a bar, fine, if you corrected the shadows, no, in the latter case there is no quick solution at all. 500 bars is not the right amount of hash for it.

I meant hash by TOHLC

But there's really no point, probably.

 
TheXpert:
If you inserted or deleted a bar, fine, if you tweaked the shadows, no, in the latter case there is no quick solution at all. 500 bars is not enough to hash it.

Thanks, I'm not familiar with hashes. Is 500 bars too little or too much for a hash?

 
Andrey Khatimlianskii:

I meant hash by TOHLC

But there's really no point, most likely.

Thanks, I'll compare TOHLC arrays then.

 
Nauris Zukas:

Thanks, I'm not familiar with hashes. Is 500 bars too little or too much for hashing?

If the loop on 500 bars and comparison of their values with stored ones had to be done many times, and it would be longer than counting hash and comparing it with memorized one in the same loop, then it would make sense.
But this is hardly the case.

What's taking you so long to count that you notice the rare occurrence of resetting prev_calculated?