How can I check if the terminal was just started and the indicator runs the first time?

 

As an example, I scan for fractals. As soon as a new fractal is formed an alert pops up. I do this on different timeframes.

But when I open the terminal I would like to know where the last fractal is. So I have to loop back. But I need this loop just once. Then the indicator scans for real time fractals.

How do I know that the terminal just started so I can execute the loop?

 

Terminal just started, indicator just added to a chart, or new history downloaded, is the same. OnCalculate's prev_calculated is zero.

You don't need to care. Just code your main loop properly
          How to do your lookbacks correctly.

 
whroeder1:

Terminal just started, indicator just added to a chart, or new history downloaded, is the same. OnCalculate's prev_calculated is zero.

You don't need to care. Just code your main loop properly
          How to do your lookbacks correctly.

Thank you!