Unnecessary. There is no need to create pending orders in code.
- The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker,) B) there's no round trip network delay (filled quicker.)
- Don't worry about it unless you're scalping M1 or trading news.
- Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
Hi,
Sorry for probably an easy question but I just started learning how to mql5.
Let's say I have two simple pending orders, a long and a short, waiting to get triggered
trade.BuyStop(0.1,longpriceentry,_Symbol,LTP,LSL, ORDER_TIME_GTC );
trade.SellStop(0.1,shortpriceentyr,_Symbol,STP,SSL,ORDER_TIME_GTC);
I would like to continuously check whether one of the two orders got through, determine which one was triggered (the long or the short) and immediately cancel the one which is still pending.
Could somebody help me with this insight? Do I write an IF statement within OnTick, and check the status with CPositionInfo Select method, and then do a trade.PositionClose ? But how do I know which one to close etc?
thanks in advance
//n00bie
The simplest thing is to track (in OnTradeTransaction) the appearance of a new position. If a position has appeared, issue an order to delete pending orders.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
Sorry for probably an easy question but I just started learning how to mql5.
Let's say I have two simple pending orders, a long and a short, waiting to get triggered
trade.BuyStop(0.1,longpriceentry,_Symbol,LTP,LSL,ORDER_TIME_GTC);
trade.SellStop(0.1,shortpriceentyr,_Symbol,STP,SSL,ORDER_TIME_GTC);
I would like to continuously check whether one of the two orders got through, determine which one was triggered (the long or the short) and immediately cancel the one which is still pending.
Could somebody help me with this insight? Do I write an IF statement within OnTick, and check the status with CPositionInfo Select method, and then do a trade.PositionClose ? But how do I know which one to close etc?
thanks in advance
//n00bie