Close positions question

1 replies


Subscriber, bbp_participant, community, 14 replies.

Visit profile

6 years ago #114836

Hello, I have a question, 

I have a pending stop order system. 



If condition met



buy stop + 2 pips of the (high)



my question is, I want to close the opposite order -only if- 

my buy order is executed. (not when the signal came, because, every signal does not end with orders)


So when I add the “close position” under the “buy stop” order, 

it closes the position even the opposite is not open yet. 




When I create a new condition like this, it enters a loop and doesnt open the new order.

Because it recognizes the “buy stops” magic number as if it is already opened.



if position long is open,



close position short



Can you help?





Administrator, sq-ultimate, 1 replies.

Visit profile

6 years ago #135625

If you create two orders on signal – 1 BUY STOP (magic 1) and 1 SELL STOP (magic 2) and you want to make them OCO – One cancels other you can add a new condition that says:


if (Market Position is Long AND Pending Order Exists (2)) => Close Position (magic 2)

if (Market Position is Short AND Pending Order Exists (1)) => Close Position (magic 1)


That’s all. Also do not check “Evaluate on bar open only” on condition tab


Viewing 2 posts - 1 through 2 (of 2 total)