Indicator won't update properly

 

Hi,

I'm new to this forum and I need help with an indicator I am building.

I have attached the .mq4 file and a picture of the chart.

I am new to mql programming and this is my first attempt at a simple indicator.

My question is, how do I get the trend lines to move forward in time?

This simple indicator draws four trendlines on the chart, and should move

forward with each new bar. Right now it only paints when added to the chart. If I delete the indicator and re-apply, it paints correctly. If I leave it on the chart, it won't move forward. What do I need to add to the code so the four trendlines are re-painted with each new bar, and the old ones deleted. (It is acting more like a script that only runs once when applied.)

It should use the two previous bars prior to the current active bar.

Thanks, Brad

Reason: