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
   uint             count=WHOLE_ARRAY   // number of the rates[] array elements to be used



[in]  Custom symbol name.


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


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

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