Close after number of bars

 

Hi all,

¿do you have some code to close trades after a number of bars?.

Regards.

 

Something like this :

if (iBarShift(NULL,0,OrderOpenTime())>=RequeredNumberOfBars)

{

// add code to close the order here

}
vibarco:
Hi all,

¿do you have some code to close trades after a number of bars?.

Regards.
 

Thanks mladen,

do i have to filter the order that i want to close before de conditional?.

Best,

Vince.

 

Yes

That code snippet should be applied to already selected order

vibarco:
Thanks mladen,

do i have to filter the order that i want to close before de conditional?.

Best,

Vince.
Reason: