Support and Resistance Indicator help in EA strategy tester

 

Hi All,

My first post, after some long time reading and using MT5. Recently i started like all others with creating an own EA.
I have created multiple indicators before and used them in my EA with success. Only since a week i have started using a new indicator
which i did not created my self i found it on this forum https://www.mql5.com/en/articles/3186

The indicator works correctly when attached to a new chart, so i was a happy coder. When i added it to my EA all looked good until i
started testing it with the strategy tester and i discovered an issue. I have used google / this forum to find my answer but no luck.

The issue i experience is that the indicator draws the lines correctly for all the bars before my test starts and in the test period all lines
are drawn at the same point. If i check the values i see they are all the same.

The following screenshot shows my issue more clearly, left side of the yellow line the lines are drawn correctly. right side of the
yellow line my test period starts and all lines are drawn on the same points (blue line)

SR

Attached is the indicator i am using

What am i doing wrong,

An example of an indicator drawing Support and Resistance lines
An example of an indicator drawing Support and Resistance lines
  • 2017.07.07
  • Andrey Kisselyov
  • www.mql5.com
With this article, the most ancient price level forecasting method of technical analysis will become available to all who want to use it. In addition to having a ready-to-use indicator that draws trend lines (support and resistance lines), you will see how simple the indicator creation process is. You will learn how to formulate conditions for...
Files:
 
Does this happen also when you change the indicator period to H1 for example?
 
Finally fixed the issue, i was not copying the right amount of bars for the Daily period.
When i moved 3 lines to the OnCalculate method it works like a charm.

Attached the fixed indicator.
Files: