The [tp] tag removed in some brokers? - page 3

 
cameofx:

[...] Why does MT4 & MT5 introduce OrderCloseReason() or something?

Don't know... But it's solvable, so it's not a big deal.
 
gordon:
Don't know... But it's solvable, so it's not a big deal.

Yeah... where can I keep an update of SL & TP then, OrderComment()?

Lots of new goodies in MT5, btw, more kudos than complaints all in all.

 
cameofx:

Yeah... where can I keep an update of SL & TP then, OrderComment()?

Na, I wouldn't recommend it (IMHO). See my previous remark about server's overwriting comments (https://www.mql5.com/en/forum/123668/page2#267154). Since I wrote that post I have found cases were more than 6 characters are overwritten by the server (for example -> https://www.mql5.com/en/forum/124167), so I wouldn't trust it altogether.


If it's virtual TP/SL, then just keep their values in an array. But you would have to built persistence capabilities into the EA, otherwise these values will be lost in case of total failure (Terminal restart, power out, etc.).

 
gordon:

Na, I wouldn't recommend it (IMHO). See my previous remark about server's overwriting comments (https://www.mql5.com/en/forum/123668/page2#267154). Since I wrote that post I have found cases were more than 6 characters are overwritten by the server (for example -> https://www.mql5.com/en/forum/124167), so I wouldn't trust it altogether.


If it's virtual TP/SL, then just keep their values in an array. But you would have to built persistence capabilities into the EA, otherwise these values will be lost in case of total failure (Terminal restart, power out, etc.).

"...If it's virtual TP/SL..." we're still on the subject of checking whether an order is closed by an SL/TP/Other right? If it's a virtual then we would know the closing price and how it was close.

Have you solved the persistence layer capabilities Gordon? Thanks.

 
cameofx:

"...If it's virtual TP/SL..." we're still on the subject of checking whether an order is closed by an SL/TP/Other right? If it's a virtual then we would know the closing price and how it was close.

Exactly. The question only arises when there's server-side TP/SL and additionally the EA might or might not close orders manually under certain circumstances....


Have you solved the persistence layer capabilities Gordon?

Sure. There's a good discussion about this topic here -> https://www.mql5.com/en/forum/119716.
 

Thanks, 

https://forum.mql4.com/25078.  -  offers much great insights but one thing I can take from it is that MT4 (maybe -5 too, to date), is not accommodating many aspects of 'Automated Trading'. 

Right now what I'm trying to achieve is the 'Virtually Automated Trading' with as little 'apprehension' as possible. I simply cannot do (yet) that many precautionary workarounds, that even veterans like fbj need to hack. If the developers are ready to make it really accountable for traders to trade Automated then, by all means I will unleash an EA on live account unattended for x months/years. 

 
gordon:

Hmmm.... Maybe I'm missing something, but are there any cases where the following won't be enough?

   // select the closed order first and then do this:
   
   double sl_diff = MathAbs(OrderClosePrice() - OrderTakeProfit()),
          tp_diff = MathAbs(OrderClosePrice() - OrderStopLoss());
   
   if ( sl_diff > tp_diff )
      Print("order closed at tp");
   else
      Print("order closed at sl");
 

// I assume here that an equality of sl_diff and tp_diff is impossible...?

In fact there are 3 scenarios in the closed orders,

1. The price hit the TakeProfit value. (TP)
2. The price hit the StopLoss value. (SL)
3. After some time, the trader closed the order manually without hit TP/SL.

My question is: How to know the 3 different closed reasons for my historical orders? Thanks.


 
It was answered in the thread. See cloudbreaker's answer here -> https://www.mql5.com/en/forum/123668. There's no shortcuts here, that's the only way to do it.
 
Ok, thank you. gordon. I will study this method carefully. In fact I do not understand it now.
 

Can I get the order closed reason from the colors?

Because I found

1. if the order is closed by SL, the stoploss value color is red,
2. If the order is closed by TP, the takeprofit value color is green.
3. If the order is closed manually, the values colors are not changed.

Thanks.

Reason: