I am trying to work out the best way to say: if a certain ticket is opened, then open a new pending order. I am having trouble with order selects and finding tickets in previous functions so help would be much appreciated.
I want to say : if ticket3 is open, OrderSend ticket4.
Many thanks!
bool res = OrderModify(ticket,price-0.0050,StopLossLevel,0,0,clrNONE); if(res)Alert ("ticket modified"); int ticket3 = OrderSend (Symbol(), OP_BUYLIMIT,lotsize1,StopLossLevel+0.0002,10,0,0,"LotLimit1",0,0,clrRed); int ticket4; if(ticket3>0)ticket4 = OrderSend (Symbol(), OP_BUYLIMIT,lotsize1,StopLossLevel+0.0002,10,0,0,"LotLimit1",0,0,clrRed); if(ticket4>0)Alert ("ticket4 opened");
Hi thanks again for your response,
this is nearly it; however when you say: if(ticket3>0) . ticket3 is a BuyLimit order. Ideally I only want to send ticket4 after the limit has been activated as a Buy and not if it stays as a limit. Perhaps something like if(ticket3 == open) but I am not sure what this would be?
if(OrderSelect(ticket3,SELECT_BY_TICKET) && OrderType()==OP_BUY) { //pending order 3 has triggered //insert code to open a new pending order }
Of course, you will have to include safeguards so that the new pending order is not opened again and again.
Of course, you will have to include safeguards so that the new pending order is not opened again and again.
I'm afraid this doesn't seem to work:&& OrderType()==OP_BUY)
ticket3 will be opened as a BuyLimit, so I don't think they OrderType will ever exist as OP_BUY. Rather, when the price falls back down to activate the BuyLimit so it then opens - ticket4 is opened.
Is there a way to say: if order is now as Buy , without the ordertype being OP_BUY?
I'm afraid this doesn't seem to work:&& OrderType()==OP_BUY)
ticket3 will be opened as a BuyLimit, so I don't think they OrderType will ever exist as OP_BUY. Rather, when the price falls back down to activate the BuyLimit so it then opens - ticket4 is opened.
Is there a way to say: if order is now as Buy , without the ordertype being OP_BUY?
Suit yourself
Suit yourself
Do you know of a way to say only if the buylimit is opened and not just set as pending? Thanks
Do you know of a way to say only if the buylimit is opened and not just set as pending? Thanks
I already told you
if(OrderSelect(ticket3,SELECT_BY_TICKET) && OrderType()==OP_BUY)
But you don't like my answer.
I already told you
But you don't like my answer.
Apologies, it's not that I don't like your answer, but when I use the code the ticket doesn't open, because the order type is not OP_BUY it is OP_BUYLIMIT. I think I might be unclear of what I would like. Ideally ticket3 would open as a BuyLimit. Only when the BuyLimit is opened does the 'if' function come into place, rather than the 'if' saying that the ordertype is already written as OP_BUY, if that makes sense? No worries if not I will continue to figure it out
Do not double post.
You have this thread open so why open another that is basically following on from this one?
The other topic has been deleted.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to work out the best way to say: if a certain ticket is opened, then open a new pending order. I am having trouble with order selects and finding tickets in previous functions so help would be much appreciated.
I want to say : if ticket3 is open, OrderSend ticket4.
Many thanks!