![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Ok! Then, good coding! 👍
Ok! Then, good coding! 👍
Thank you very much for taking the time to help out, it's nice to see there are a few experienced coders that will help a new person out without the need to make us feel like crap first.
One thing I've been looking at as far as this code is this part:
My understanding of prev_calculated is that it's value is equal to the last value of rates_total. So, in what situation would prev_calculated be greater than rates_total? It just seems that it would always be equal or less than.
First Cycle:
rates_total = Bars;
prev_calculated = 0;
Second Cycle:
rates_total = Bars;
prev_calculated = Bars;
Candle Close:
rates_total = Bars (+1 from last cycle);
prev_calculated = Bars;
Another thing I was toying with was calling the REX indicator at a different timeframe. However, obviously a different timeframe isn't going to have the same number of bars as the current timeframes rates_total.
Would there be a way to rewrite that code block so that nBarUpdates could be used to call a different timeframe?
There can be rare cases where that happens. Say a user reduced the number of bars for charts, or a broker reduced the number of available historical data. So, it's a precautionary measure.
For a different time-frame, I would not recommend you store the copied data into a buffer, because obviously none of it will sync up with the other buffers.
It would have to be handled in a completely different way.
At your current level of coding, I would recommend you wait until your skill and knowledge has improved somewhat more.