MQL5 ReferenceCustom SymbolsCustomRatesReplace 

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
   );

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.

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