The indicator you are trying to modify draws the pivot lines as objects, so it is an extra job to draw the lines for older data and the number of objects (lines) grows as time passes. An alternative approach is to use indicator buffers so they will be drawn for the whole chart. Fortunately, I have already coded such a pivot point indicator. Some time ago I uploaded one for daily pivots into the codebase (https://www.mql5.com/en/code/8685). I see your indicator is for weekly pivots so I will attach mine for weekly pivots.
My motivation in this forum is to learn and help other people learn, but in this case modifying the indicator you are working with would be like starting again. I urge you to read the code and ask any questions to help understand it.
I tried both indicators and they each give the same results as each other on my MT4. I have had only a quick look at your and my weekly pivot indicators and I can see only one difference that may be significant.
- In my indicator I use the values from the chart and look for the bars where the week changed. I then use iHighest() & iLowest() to determine the high and low and the previous bar close for the weekly close.
- In your indicator you use the weekly data directly.
I suspect that sometimes they are different because I have seen that sometimes the daily data is different from what can be seen on shorter timeframes.
The forumale for R2, R3, S2 and S3 appear different but they are mathematically the same.
if you have done please also give it to me to examin the past pivot activity of the pivot thank you