I need help real quick, and would really appreciate if someone could help me... it think's it's an easy problem, but I just can't get it right:
I will open a position and a few pending orders. Once the open position has reach it's profittarget, i want all the pending orders to be deleted. (This works). My problem is that i can't get the condition if the open positions is closed right.
I was hoping there is some command for to check "if profittarget is filled"...
I tried another solution, by running trough all orders (opened and pendings) and to count how many open positions it were (OP_BUY) with this code:
The codes that comes after ... I know works, it's the conditions i've fucked up somehow..
Anyone? I really appreciate quick help!
Thanks in advance
I will open a position and a few pending orders. Once the open position has reach it's profittarget, i want all the pending orders to be deleted. (This works). My problem is that i can't get the condition if the open positions is closed right.
I was hoping there is some command for to check "if profittarget is filled"...
I tried another solution, by running trough all orders (opened and pendings) and to count how many open positions it were (OP_BUY) with this code:
Inserted Code
int total = OrdersTotal(), totalopen=0; for(i=total-1;i>=0;i--) { OrderSelect(i, SELECT_BY_POS); int type=OrderType(); if(type==OP_BUY) totalopen++; } //if if(totalopen==0) { ..
The codes that comes after ... I know works, it's the conditions i've fucked up somehow..
Anyone? I really appreciate quick help!
Thanks in advance