Where to place Start() function in MQL code?

 
Hello,

Let's assume we are in very fast moving markets. Should I be placing the Start() function at the start of my MQL code or at the end? I noticed that in the MT4 samples for MACD and Moving Average, the Start() function appears at the start and end of the program respectively. Which one is right? I would have thought that Start() function should always be inserted at the start of the MQL program, as we want to check if have enough bars available for calculations and that have enough funds for trading first, before we look at entry and exit conditions. If this is correct, why does the Moving Average example in MT4 place Start() function at end of program? Or does it not really matter where in the code we place the function?

Thanks in advance.

Regards

RJF
 
Hello,

Let's assume we are in very fast moving markets. Should I be placing the Start() function at the start of my MQL code or at the end? I noticed that in the MT4 samples for MACD and Moving Average, the Start() function appears at the start and end of the program respectively. Which one is right? I would have thought that Start() function should always be inserted at the start of the MQL program, as we want to check if have enough bars available for calculations and that have enough funds for trading first, before we look at entry and exit conditions. If this is correct, why does the Moving Average example in MT4 place Start() function at end of program? Or does it not really matter where in the code we place the function?

Thanks in advance.

Regards

RJF

It does not matter where you place your function because the function is executed by calling it not by sequence.
Reason: