determine bar where stop loss or take profit was taken

 

Good day to everyone,

I'm having some trouble in determining the bar where a stop loss or take profit is taken for an order.

The strategy that I'm trying to implement states that a new order can only be placed if no older orders were opened or closed (through stop loss/take profit) on the same bar.

Any suggestions are welcomed.

 

Regards

AlexZ 

 
AlexZFx:

Good day to everyone,

I'm having some trouble in determining the bar where a stop loss or take profit is taken for an order.

The strategy that I'm trying to implement states that a new order can only be placed if no older orders were opened or closed (through stop loss/take profit) on the same bar.

Any suggestions are welcomed.

 

Regards

AlexZ 

 


iBarShift

OrderCloseTime

How have you tried ???

Show your attempt... 


 
deVries:

iBarShift

OrderCloseTime

How have you tried ???

Show your attempt... 

Hello deVries,

I've only managed to solve the first part with no new orders on same bar .

For the second part I will try your suggestion using iBarShift andOrderCloseTime, and I will come back with feedback.

At a first glance the order close time of previous orders should be checked against the open time of the bar that I am using for a new order.

As mentioned I will post back.     

 

Thank you for your time,

AlexZ 

 
AlexZFx:

 I'm trying to implement states that a new order can only be placed if no older orders were opened or closed (through stop loss/take profit) on the same bar.

It is not difficult to do

you have only to check if OrderOpenTime( ) > Time[0]   in the Open trades and also in your closed trades (OrdersHistory)  Here you have also to check OrderCloseTime ( ) >Time[0]

Reason: