Passing condition before Pending order excute ?

 

Hello

i am stuck on this one , appreciate any idea


my EA is placing Pending orders according to certain conditions , lets say will execute after 2 bars are bullish

after these 2 bars passed is another condition which will be one EMA on top of the other .

now if i placed the EMA condition from the start it cant be done as the EMA condition is not met yet

and i cant place it after as the pending orders are already on place

also monitoring the price and placing instant orders will tie up my EA

any thoughts


thank!

 

Just open in the editor ...\Include\Trade\Trade.mqh

and search for OrderModify(). There you can see how to modify a pending order and all other things you might want to do like delete and place again ...

 
Ahmed_Fouda:

Hello

i am stuck on this one , appreciate any idea


my EA is placing Pending orders according to certain conditions , lets say will execute after 2 bars are bullish

after these 2 bars passed is another condition which will be one EMA on top of the other .

now if i placed the EMA condition from the start it cant be done as the EMA condition is not met yet

and i cant place it after as the pending orders are already on place

also monitoring the price and placing instant orders will tie up my EA

any thoughts


thank!

For indicator-linked conditions, there is usually no way of doing so. A solution would be the following: save the price in a global variable, and have a function that checks if the current price crosses the saved price, just like a pending order price would be « saved » until expiration / execution of the order. 
 
Ahmed_Fouda: my EA is placing Pending orders

There is no need to create pending orders in code.

  1. 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.

  2. 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.