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

 
cloudbreaker:
It is possible. You would need to build logic to do the following: - Persist information regarding orders the EA has closed - Continuously check the Order History pool for orders which are "in scope" but which your EA has not closed - Check sign of profit to determine whether a broker invoked SL or TP Works for me. CB

This method can be used in most MT4 Broker platform without issue, but I found it does not works in the MBTF MT4 Broker demo platform. The MBTF MT4 platform do not record any comments in the closed orders by clients(manually or EA). It is impossible to judge whether one order is closed by server or client in this kind of broker platform.

I still think MetaQuotes should add the API like as OrderCloseReason() to resolve this issue.

 
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...?
but, Here you get a solution how to do it
 
qjol:
but, Here you get a solution how to do it
Read the whole thread. This method does not take into account a situation where an order was manually closed or closed by an expert (and not by tp/sl), hence it is limited. The way to do it is via what CB suggested... No shortcuts here.
 
aihua5:

[...] I still think MetaQuotes should add the API like as OrderCloseReason() to resolve this issue.

Now that MT5 is out that's not likely to happen. At the most we'll get some bug fixes for MT4... I doubt there will be any new features...

 
gordon:
Read the whole thread. This method does not take into account a situation where an order was manually closed or closed by an expert (and not by tp/sl), hence it is limited. The way to do it is via what CB suggested... No shortcuts here.


You r right have not read the whole thread, but, if it's closed by the EA Or manually the user has the way to know this the only problem is to find out if it's closed By TP or ST

This is where you come in. with your code.

 
qjol:


You r right have not read the whole thread, but, if it's closed by the EA Or manually the user has the way to know this the only problem is to find out if it's closed By TP or ST

This is where you come in. with your code.

Maybe the user doesn't remember closing manually. Maybe he doesn't realize that the EA closed the order. Maybe he wasn't the one that developed the expert so he has no idea about these things... Of course if we assume that only TP/SL are possible then the solution is easy. But the whole point of this thread is that we don't know (which means we don't assume it).
Reason: