Hi , I am working on this indicator with the goal to multiply the RSI value with the (body) size of the current candle (or the equivalent of what
was the current candle for the previous bars).
It works in mt4, but when I add property strict the code still compiles but no longer outputs the buffer (displays no data).
I have checked and found that in my for loop, the line where the buffer gets the value, the problem is that I multiply by (Close[i]- Close[i+1]);
Could someone please tell me why this is and what I should do? The code does work if I remove the above mentioned. (or if I do not include property
RSIxCandleBuffer[i]=(iRSI(Symbol(),0,RSI_Period,PRICE_CLOSE,i)) * (Close[i]- Close[i+1]);
It works in mt4, but when I add property
strict the code still compiles but no longer outputs the buffer (displays no data).
the problem is that I multiply by (Close[i]- Close[i+1]);
Could someone please tell me why this is and what I should do?
#property indicator_typeX DRAW_LINE // Bug 1090 must set.
SetIndexStyle(X-1, DRAW_LINE); // Or in OnInit().
Firstly, thanks for your reply. When I compiled the code it worked and when I added property strict it stopped working.
1. Sorry I did not see that, as far as I knew it was in the indicators section
2. I have done that as far as I can tell, I will attach a file.
3. I don't know why its the problem, but I found that if I remove that line, the code does display the buffer. So it is my question if anyone knows
what I did wrong.
4. I'm not sure what you mean but I will attach my code, I was just trying to point out the problem instead of posting the entire code and asking if
anyone knows what's wrong with it , I figured that would be more difficult.
i=Bars-Counted_bars-1; // Èíäåêñ ïåðâîãî íåïîñ÷èòàííîãî
while(i>=0) // Öèêë ïî íåïîñ÷èòàííûì áàðàì
RSIxCandleBuffer[i]=iRSI(Symbol(),0,RSI_Period,PRICE_CLOSE,i) * (Close[i]- Close[i+1]);
When Counted_bars is zero (first run), i equals Bars-1, and i+1 equals Bars. Close[Bars]
does not exist and Updated
MQL4 - Language Basics - MQL4 Reference states:
Old MQL4 compiler
New MQL4 compiler
New MQL4 with #property strict
"Array out of range" does not cause a critical error
Ditto, except for the arrays of structures and classes, for which this error is critical one
"Array out of range" is a critical error causing the program to stop
Thank you William. The Table you added helps to understand the reason why this happens.
I did not know about the log in the experts tab, I did not even have terminal on screen. Debugger I still don't know how to work it yet.
I was unsure what the array out of range was caused by when you first pointed it out, but as you said it is referring to a non existing reference.
I used your lookback code in the "Old" section, and it worked from the moment I clicked compile.
I am looking into the new even handlers, this was my first indicator I did myself, but with the file provided on this site as a tutorial as my
starting point. That is where I got the lookback code from in the first place.
The "Had you bothered phrase above" I found that not very satisfactory.
Anyway, You have helped me to solve my problem and no one else did , so thank you very much.