How to mantaint a single order opened (in an EA)?

 

Hi, may I ask:

It's possible when an EA opens an order, keep JUST that order?

I mean, I want that, whean an EA opens an order, keep that order until S/L or T/P is reached, and just to open positions where there are no orders opened.

Thanks in advance.

 

Yes, certainly.

You need to be more specific, maybe the EA you're referring to is designed to take multiple positions..?

 
WNW:
Yes, certainly. You need to be more specific, maybe the EA you're referring to is designed to take multiple positions..?

No, the EA I'm talking of is designed to keep and mantain a single position until S/L or T/P is reached.

Thanks for answering.

 

As I understand you are talking about one order per chart, right?

Most of EAs were coded as one order per chart so it is very usual case.

For some usefull codes please look at this thread https://www.mql5.com/en/forum/174329 and about how to code one order per chart/Metatrader/candle and so on please read this thread https://www.mql5.com/en/forum/173026

 

There are several ways to do it, check for TotalOrders(), for unique MagicNumber(), OrderComment() or OrderSymbol().

I would do it with MagicNumber.

cheers

euro

 

Thanks everybody for the answers

Reason: