Indicator clutter

 
Why does it look like this once when I look at the chart?
Files:
trendline.mq4  4 kb
 

This is the correct shape

 
Hossein Gholamshazari: Why does it look like this once when I look at the chart? This is the correct shape

How do you expect us to answer you with no details about your setup, what your code is, etc.

We cannot read minds or make mental remote observations.

Please! If you want help, then explain things in detail!

 
Fernando Carreiro:

How do you expect us to answer you with no details about your setup, what your code is, etc.

We cannot read minds or make mental remote observations.

Please! If you want help, then explain things in detail!

Thank you for your attention

I want to design an indicator to draw the trend line; And this is the initial plan that connects all the peaks and valleys. But the problem is when I go to the past chart and the past candlesticks are loaded; Everything falls apart.

Files:
trendline.mq4  4 kb
 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

I downloaded your indicator and opened it in the editor.

I noted the complete lack of meaningful variable names and immediately closed it again.

If you want help with your codes you should use meaningful variable names.

 
Keith Watford:
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

I downloaded your indicator and opened it in the editor.

I noted the complete lack of meaningful variable names and immediately closed it again.

If you want help with your codes you should use meaningful variable names.

thanks , i will change variable names and send it again soon

Reason: