Hello, I believe that in the 2 functions CustomRatesUpdate and CustomRatesReplace, there is a bug on the return value. Even if no bars are added or changed, they always return the value of the number of items passed to them.
So if you pass an array with 10 elements, they return 10 elements.
Instead they should return the actual number of changes made to the time series.
- Custom symbols. Errors, bugs, questions, suggestions.
- iRSI indicator changes close price inside. It causes different indicator values
- CustomRatesUpdate and CustomRatesReplace causes flickering on chart screen
The documentation says
If such a bar already exists, it is replaced.
CustomRatesUpdate - Custom Symbols - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
You passed 10, it replaced 10, it returns 10. CustomRatesUpdate - Custom Symbols - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Giovanni Riccobene: Instead they should return the actual number of changes made to the time series.
It does not say that it checks if anything has changed; that would be computationally expensive. So no, it should not "return the actual number of changes."
William Roeder #:
The documentation says You passed 10, it replaced 10, it returns 10. It does not say that it checks if anything has changed; that would be computationally expensive. So no, it should not "return the actual number of changes."
The documentation says You passed 10, it replaced 10, it returns 10. It does not say that it checks if anything has changed; that would be computationally expensive. So no, it should not "return the actual number of changes."
Yes but the return value say:
Return Value
Number of updated bars or -1 in case of an error.
Consequently I expect it to return me the actual number of changes, and not the number of values I passed to it, otherwise the function might just return me a boolean, so why return me a value and not a simple true or false?
Clearly for me it is not a problem, it will mean that I will perform a preventive check to verify if there are any real changes to be made to the time series. But honestly I would have preferred the integrated function to do this for me!
Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Runtime Errors
- www.mql5.com
Runtime Errors - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register