Custom Indicator for EA doesnt work as intended

 

Hi guys, first just wanted to thank everyone who makes an effort to read my concern.

Here goes:

1. I created an Custom Indicator. Working Fine. (Checked)

2. Created an EA from my EA template. Used donchian channel method as error checked for basic function i.e. trading/SL/trailing/etc. No custom indicator was called or used, I just use iHighest,etc inside EA. Working Fine. (Checked)

3. Now, I tried applying/getting the feed from the Custom Indicator to the EA. From the articles I read, I goes like this:

- Get handle. Place it on Onit of EA.

- OnTick. Copy buffer from handle to an array. use arraysetasseries.

- use the Array as intended. Using Array[0] as present bar, Array[1] the previous bar, so on.

However the Array is returning wrong numbers/data when I tried testing and printing the Array for info.

Moreover when I use Strategy Tester on Visualization, it looks like this (See attached image, Mt5 terminal vs Mt5 Tester). The two yellow arrows on the picture points the same bar. And it clearly shows something is wrong.

Please advise, articles I read havent really help my situation. Any replies or leads is appreciated! thank you!

MT5 terminal vs MT5 tester Custom Indicator

 
Normal data alignment in MT5 starts from zero. i.e. Array[0], Array[1], Array[2]....., Array[rates_total - 1]. Are you considering it?
 
Naguisa Unada:
Normal data alignment in MT5 starts from zero. i.e. Array[0], Array[1], Array[2]....., Array[rates_total - 1]. Are you considering it?

Yes. I set the ArraySetasSeries to true. To mention, the values from the tester vs what is shown in the terminal are different. From what I know even if arrayasseries are not set, they should show same values or at least when I ArrayPrint the buffer. Or am i missing something?

On an update: I am currently going over again basic articles on how create indicators, maybe have some leads to my situation.

Reason: