MQL5 ReferenceCustom SymbolsCustomRatesUpdate 


Adds missing bars to the custom symbol history and replaces existing data with  the ones from the MqlRates type array.

int  CustomRatesUpdate(
   const string           symbol,       // custom symbol name
   const MqlRates&        rates[]       // array for the data to be applied to a custom symbol



[in]  Custom symbol name.


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

Return Value

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


If there is no bar from the rates[] array in the current custom symbol history, it is added.  If such a bar already exists, it is replaced. All other bars in the current price history 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

CustomRatesReplace, CustomRatesDelete, CopyRates