CustomRatesReplace

Fully replaces the price history of the custom symbol within the specified time interval with the data from the MqlRates type array.

int  CustomRatesReplace(
   const string     symbol,             // symbol name
   datetime         from,               // start date
   datetime         to,                 // end date
   const MqlRates&  rates[],            // array for the data to be applied to a custom symbol
   uint             count=WHOLE_ARRAY   // number of the rates[] array elements to be used
   );

Parameters

symbol

[in]  Custom symbol name.

from

[in]  Time of the first bar in the price history within the specified range to be updated.

to

[in]  Time of the last bar in the price history within the specified range to be updated.

rates[]

[in]   Array of the MqlRates type history data for M1.

count=WHOLE_ARRAY

[in]  Number of the rates[] array elements to be used for replacement. WHOLE_ARRAY means that all rates[] array elements should be used for replacement.

Return Value

Number of updated bars or -1 in case of an error.

Note

If the bar from the rates[] array goes beyond the specified range, it is ignored. If such a bar is already present in the price history and enters the given range, it is replaced. All other bars in the current price history outside the specified range remain unchanged. The rates[] array data should be correct regarding OHLC prices, while the bars opening time should correspond to the M1 timeframe.

 

See also

CustomRatesDelete, CustomRatesUpdate, CopyRates