multiple orders on.....

 

Hello everyone. Can anyone help me with this? I have an EA that places two orders(of the same type) and I want to have the EA assess and see if both are opened. I know if I use orderselect, that includes BOTH open and pending orders so that doesn't work so well.

1. if I have a selllimit with a certain order number, will the order number remain once the order is opened? For example, if price goes up and the order opens, will the ordermagicnumber correspond to an ordertype of SELL versus SELLLIMIT prior to opening? This may be what I need to discern if my second order is opened. Any help would truly be appreciated....this forum is great! Thanks to everyone...... Daniel


To further clarify, let me just put out here what I really need help with. I have an EA that places two trades: one instantly and then another limit order. What I really need is for the EA to assess and see if both of these orders are open at the same time. Then I need it to see if the orderprofit for both net out to even or plus a certain value. Then I want to close the orders. Is this too complicated? Any help, again, would be greatly appreciated!!! Thanks all......

 

When you place a pending order it will be a SELLIMIT as long as it is still pending. When it gets activated, it becomes a simple SELL with OrderType(). So if you want to check the *open* orders only, just always check for OP_SELLs and OP_BUYs and it will do what you want it to do.

.

Jon

 
Archael:

When you place a pending order it will be a SELLIMIT as long as it is still pending. When it gets activated, it becomes a simple SELL with OrderType(). So if you want to check the *open* orders only, just always check for OP_SELLs and OP_BUYs and it will do what you want it to do.

.

Jon

Yes, but will it correlate the ordertype to the ordermagicnumber!? I need to specifically see if the order has been filled..........will the ordermagicnumber stay with the order, even though the order is not a limit order but a straight sell or buy? If so, that will do it! :)

 

Hi Jon

The purpose of the magic number is to tie the order to an EA. Wouldn't just counting the open orders of the specific magic number give you what you want? With one pending and one open you would get a count of 1 and when the pending order was taken you would get 2. Then you can check profit and close.

 
Ruptor:

Hi Jon

The purpose of the magic number is to tie the order to an EA. Wouldn't just counting the open orders of the specific magic number give you what you want? With one pending and one open you would get a count of 1 and when the pending order was taken you would get 2. Then you can check profit and close.

Thanks for the info.....I have 5 other EA's on at one time! So, correlating and ordertype to a magicnumber would do what I need, I had this strategy running and working effectively but before I added another trading strategy and EA's. SO.....I need to get this one single EA autonomous so that it can work well with the others....Dan

 

Ruptor, I'm Jon but it's forexman05 that needed the help ;)

.

forexman05, your magic number will persist for the life of the order regardless of if it's been filled, cancelled, or modified. I don't believe you can change the magic number after OrderSend() even if you wanted to.

.

Jon

 

Jon,


Thanks for the info...that is exactly what I needed to know! Dan

Reason: