Python scritp, how to merge two ticks result of "copy_ticks_range"?

 
I have loop with variable begin date-time, what move to the future time ... Example:


totalTicks = numpy.array([])
while True:
        utcBegan += timedelta(hour=4) 
        ticks = mt5.copy_ticks_range(Symbol, utcYearBegan, utcYearEnd, mt5.COPY_TICKS_ALL)
	totalTicks += ticks or totalTicks.add(ticks) or ... ?


I want to get ticks per pack and storage them into the  dailyTicks variable ...

How to do it with numpy there? ticks is array of voids ... but I can't understand how to merge these ...

Need to exclude copies also, and other possible negative affects ...

p.s. I'm using it for load current ticks also
 
sergey087: I have loop with variable begin date-time, what move to the future time ... Example:I want to get ticks per pack and storage them into the  dailyTicks variable ...
How to do it with numpy there? ticks is array of voids ... but I can't understand how to merge these ... Need to exclude copies also, and other possible negative affects ... p.s. I'm using it for load current ticks also
Your question is more about the Python language than it is about MetaTrader. Maybe asking on a Python forum may be more helpful to you.
 

I couldn't understand what you tried to achieve but as far as I understood there is a problem with `ticks`.

It should contain an array full of data, and not null/void values.

Looking at your variable names, I am suspicious that `utcYearBegan` and `utcYearEnd` are not datetime objects but integers which might cause the problem.

Please look at this documentation in order to understand how to use the function.

***

Joining arrays:

You can play with these functions: append & concatenate

The documentation has some examples.

Best.

Documentation on MQL5: Integration / MetaTrader for Python / copy_ticks_range
Documentation on MQL5: Integration / MetaTrader for Python / copy_ticks_range
  • www.mql5.com
copy_ticks_range - MetaTrader for Python - Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5