Do not close all the positions at last

 

Dear experienced traders, 

Strategy tester will close all positions at last. 

Is there any setting could let it do not close all positions at last? 

Thank you in advance and best wishes,

Sky

 
Sky L:

Dear experienced traders, 

Strategy tester will close all positions at last. 

Is there any setting could let it do not close all positions at last? 

Thank you in advance and best wishes,

Sky

no

you need to set the EA to stop trading before the end

 
Jean Francois Le Bas:

no

you need to set the EA to stop trading before the end

Thank you, Jean. 

Could you kindly tell me where to set it? 

 
Sky L:

Thank you, Jean. 

Could you kindly tell me where to set it? 

well you need to set a variable for the datetime that is the opening of the last trade and stop trading just before that date


something like:

input datetime dateLastTrade = D'2020.01.01 00:00';

void OnTick()
{
   if (TimeCurrent() < dateLastTrade)
   {

        trade
   }
}

Jeff

 
Jean Francois Le Bas:

well you need to set a variable for the datetime that is the opening of the last trade and stop trading just before that date


something like:

Jeff

Thank you, Jean

So, the only way is try to find out the final open date, and stop before that, right? 

 
Sky L: So, the only way is try to find out the final open date, and stop before that, right? 

Not final, as in last, but earliest non-closed order's datetime.

 
William Roeder:

Not final, as in last, but earliest non-closed order's datetime.

earliest non-closed order's datetime.

Thank you, Wiliam. 

Reason: