How to place (and close correctly) multiple orders on one EA

 
Hello moderators and friends,

I posted a question under this heading, but it might have been overlooked, (since the original author had their part answered) so I'm reposting it as a new subject.

How can I write an EA to open multiple orders and close them independantly. Ex: go in on a buy, then a buy if conditions are met again, and then a sell. If you can't explain it in detail in english, (explaining things like "flag") then could you do an example with a basic Moving Average EA? I'm sorry, but I couldn't understand the answer given in the other topic.

thanks!
Samson
 
You can use the Trading functions for this.

And you have to use magic numbers to open multiple orders.

Also try to refer to 'How to place (and close correctly) multiple orders in an EA'

 
I'm sorry. The site you refered to is the one that I already posted the question but people might have overlooked. As I said in that original post, I am not getting it, and would appreciate more details like:

1) Do I have to change "CalculateCurrentOrders" function from basic Moving Average program? How?
2) Do I just add another "OrderSend" in my open and close section with a different magic number?
3) I'm still confused how the Start function part is supposed to look exactly.

If someone doesn't want to answer these questions than could you just post an example with the Moving Average EA?

thanks!
Samson
 
Opening and closing multiple orders on one EA is not as cut and dry as you might like, and there are considerations. For instance, an EA attached to a particular chart can only access data from that chart. Unless you're doing inverse/parallel pair stuff, you probably won't get exactly what you're hoping for using this method. Further, there is a strictly enforced 10 second delay between order functions. For instance, if you open a ticket, you cannot open another ticket for 10 seconds. Some things for you to think about anyway...

Lance...
Reason: