Optimize session trading hours

 

Hi all,

Wich is the way to go optimizing session range? i mean, how i can optimize sessionStart sessionEnd, could you give some example code?.

Best,

Vince.

 

At the beginning of your start() procedure put something like :

if (Time[0]sessionEnd) return(0);[/PHP]

That will prevent execution at times outside the desired session

You could use broker or local time too for that purpose but in that case back-testing might become problematic. To use broker time do it the following way :

if (TimeCurrent()sessionEnd) return(0);

and for local time use this :

[PHP]if (TimeLocal()sessionEnd) return(0);
vibarco:
Hi all,

Wich is the way to go optimizing session range? i mean, how i can optimize sessionStart sessionEnd, could you give some example code?.

Best,

Vince.
 

Thanks mladen,wich is the correct approach to do not have problems in backtesting/optimizing?Best,Vince.

Reason: