Download MetaTrader 5

Indicator re-started NOT on every tick

To add comments, please log in or register
Webmeiker
11
Webmeiker  

Hi, 

I have made my first indicator, but I don't want it to be started again and again at every tick.

Its a "slow" indicator suitable for the 4H period. So for me should be enough if it gets re-started only when a new candle opens, for example, or when the user refresesh the graphic window...

After reading the documentation I didnt find the solution. https://docs.mql4.com/basis/function/events 

This approximation works for me, but I want to know if exists a better way:

extern bool FlagOnlyOneExecution = true;

int start() {          

if (FlagOnlyOneExecution) {

//... do the thing here ...

}

FlagOnlyOneExecution = false;

Could somebody give me advice?
Thanks
whroeder1
14774
whroeder1  
Test for a new candle.
To add comments, please log in or register