Fully replaces the price history of the custom symbol within the specified time interval with the data from the MqlTick type array.
[in] Custom symbol name.
[in] Time of the first tick in the price history within the specified range to be removed. Time in milliseconds since 01.01.1970.
[in] Time of the last tick in the price history within the specified range to be removed. Time in milliseconds since 01.01.1970.
[in] Array of the MqlTick type tick data ordered in time in ascending order.
[in] Number of the ticks array elements to be used for replacement in the specified time interval. WHOLE_ARRAY means that all ticks array elements should be used.
Number of updated ticks or -1 in case of an error.
Since several ticks may often have the same time up to a millisecond in a stream of quotes (accurate tick time is stored in the time_msc field of the MqlTick structure), the CustomTicksReplace function does not automatically sort out the ticks array elements by time. Therefore, the array of ticks must be pre-arranged in time ascending order.
The ticks are replaced consecutively, day after day, until the time specified in to_msc or until an error occurs. The first day from the specified range is processed followed by the next one, etc. As soon as the mismatch between the tick time and the ascending (non-descending) order is detected, the tick replacement stops on the current day. All ticks from the previous days are successfully replaced, while the current day (at the moment of a wrong tick) and all the remaining days in the specified interval remain unchanged.
If the ticks array contains no tick data for any day (generally, any time interval), a "hole" corresponding to the missing data appears in the custom symbol history after the tick data from ticks are applied. In other words, the call of CustomTicksReplace with missing ticks is equivalent to deleting part of the tick history, as if CustomTicksDelete with the "hole" interval is called.
If the tick database has no data for the specified time interval, CustomTicksReplace will add to the database ticks form the ticks array.
The CustomTicksReplace function works directly with the tick database.