Critical error while running expert... Array out of range.

 
Hey Im trying to build an EA that will recognize divergence.
In order to do so I have multiple arrays in place, with the largest being 90.
I keep going though the code but im not able to find what causes the error.

I would really apreciate the help

I'm even testing to see RSI value and it is 0..
 

There are just too many mistakes in this code to be made by a human — Is this ChatGPT (or A.I.) generated code? 

Please don't request help for ChatGPT (or other A.I.) generated code. It generates horrible code, mixing MQL4 and MQL5. Please use the Freelance section for such requests.

 
Fernando Carreiro #:

There are just too many mistakes in this code to be made by a human — Is this ChatGPT (or A.I.) generated code? 

Please don't request help for ChatGPT (or other A.I.) generated code. It generates horrible code, mixing MQL4 and MQL5. Please use the Freelance section for such requests.

I did the code my self....

 
Oshry Benbenisty Ur #: I did the code my self....

Then I suggest you reference the documentation because there are too many mistakes.

For example, all the functions like iClose, iHigh, iLow, etc. return individual data values, not handles to be used in CopyBuffer which is for use with Indicators.

If you want to copy arrays of data from Close, High, Low, etc. then use CopyClose, CopyHigh, CopyLow, etc.

Please read the following section of the documentation: Documentation on MQL5: Timeseries and Indicators Access

Also, before using array variables, you need to declare them.

When collecting data from indicators, like RSI, you should first obtain the handle from iRSI() function in the OnInit() event handler.

You should not be reading the handle every time in the OnTick(), and the handle is an integer not a double.

Do some research by reading related coding Articles for beginers while also having a look at examples in the CodeBase.

 
Fernando Carreiro #:

Then I suggest you reference the documentation because there are too many mistakes.

For example, all the functions like iClose, iHigh, iLow, etc. return individual data values, not handles to be used in CopyBuffer which is for use with Indicators.

If you want to copy arrays of data from Close, High, Low, etc. then use CopyClose, CopyHigh, CopyLow, etc.

Please read the following section of the documentation: Documentation on MQL5: Timeseries and Indicators Access

Also, before using array variables, you need to declare them.

When collecting data from indicators, like RSI, you should first obtain the handle from iRSI() function in the OnInit() event handler.

You should not be reading the handle every time in the OnTick(), and the handle is an integer not a double.

Do some research by reading related coding Articles for beginers while also having a look at examples in the CodeBase.

thank you was able to fix the issue

 
Oshry Benbenisty Ur #: thank you was able to fix the issue

Why did you remove the code from your post?

Now this thread no longer makes any sense and any future readers will not be able to learn from it.

Please don't do that again in the future. Leave your posted questions and code intact. Don't remove it afterwards.