The function receives ticks accumulated by the terminal for the current work session and writes them into the ticks_array. It should be noted that the order of indexing goes from the past to the present, that is tick index 0 is the oldest one in the array.
[out] MqlTick type array for receiving ticks.
[in] The flag to define the type of the ticks you want to receive. COPY_TICKS_INFO only Bid and Ask, COPY_TICKS_TRADE only Last and Volume, COPY_TICKS_ALL all ticks.
[in] The first date of requested ticks. In milliseconds since 1970.01.01. If the parameter from=0 then last count tick will be written.
[in] The number of requested ticks. If the date and number are not specified, all available ticks are received, but not more than 2000.
The number of copied tick or -1 in case of an error.
The OnTick() function does not handle every tick, it notifies the Expert Advisor of market changes. It can be a batch of changes: the terminal can simultaneously make a few ticks, but OnTick() will be called only once to notify the EA of the latest market state. The CopyTicks() function allows you to request and analyze all the ticks.
If the from and count parameters are not specified, all available ticks, but no more than 2000, will be written in the ticks_array. The flags parameter allows setting the type of required ticks.