Try this code.
for(int i = rates_total - 2 ; i >= 0; i--)
It is more efficient to calculate the data in the order of oldest to newest data.
![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
Hi,
I am sure I am doing something wrong, but I did my research and couldn't find the answer.
Well, it is my first time creating an indicator, and I am confused with the results; the idea on my indicator is simple: I check the candle to see if it is bullish and closing above the high of the previous candle, and the buffer is the current high, and the opposite way for low. Technically, it doesn't make sense as I am new to this. I thought it would be a simple example to put in place, a kind of envelope of high and low.
My issue, is that when launching the indicator, it takes several tick to have the required results, which I would like to have as soon as I launch the indicator. I am sure I am missing something so asking for your kind help on this.
Below is my code and a gif of how the indicator is behaving.
Thanks in advance.