Another newbie question about this code, found at CopyBuffer - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
In what cases can prev_calculated ever be greater than rates_total?
I would think that:
a. If there's anything to copy at all, prev_calculated must be less than rates_total, otherwise it was all copies during a prior OnCalculate event;
b. in which case the to_copy value would simply be rates_total - prev_calculated;
c. So, to_copy = rates_total - prev_calculated; would always come up with the correct number of elements to copy.
d. Therefore, the entire if() structure could be simplified to that single assignment statement.
Please let me know where I'm going wrong here.
Thanks!
Another newbie question about this code, found at CopyBuffer - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
In what cases can prev_calculated ever be greater than rates_total?
I would think that:
a. If there's anything to copy at all, prev_calculated must be less than rates_total, otherwise it was all copies during a prior OnCalculate event;
b. in which case the to_copy value would simply be rates_total - prev_calculated;
c. So, to_copy = rates_total - prev_calculated; would always come up with the correct number of elements to copy.
d. Therefore, the entire if() structure could be simplified to that single assignment statement.
Please let me know where I'm going wrong here.
Thanks!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Another newbie question about this code, found at CopyBuffer - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
In what cases can prev_calculated ever be greater than rates_total?
I would think that:
a. If there's anything to copy at all, prev_calculated must be less than rates_total, otherwise it was all copies during a prior OnCalculate event;
b. in which case the to_copy value would simply be rates_total - prev_calculated;
c. So, to_copy = rates_total - prev_calculated; would always come up with the correct number of elements to copy.
d. Therefore, the entire if() structure could be simplified to that single assignment statement.
Please let me know where I'm going wrong here.
Thanks!