The [tp] tag removed in some brokers?

 

I'm using the comments to know if an order has been closed by TakeProfit or StopLoss... I've realized than in MIG BANK (real accounts) they have removed the tag "[tp]" or "[sl]" in the orders... my EAs are working in the demo account but not in the real cause they have removed the tag... I'm considering to make a comparisson between the TakeProfit's price and the close price, but it could be not precise in case of slipagge at close or whatever. Any idea?

 
isn't it one of those broker who need to modify order after ordersend() with ordermodify() to set TP and SL due to new rules ?
 
NablaQuant:

I'm using the comments to know if an order has been closed by TakeProfit or StopLoss... I've realized than in MIG BANK (real accounts) they have removed the tag "[tp]" or "[sl]" in the orders... my EAs are working in the demo account but not in the real cause they have removed the tag... I'm considering to make a comparisson between the TakeProfit's price and the close price, but it could be not precise in case of slipagge at close or whatever. Any idea?


The '[tp]', '[sl]' comments r broker specific. Some have them, some don't.

U can check if order close price is above/bellow open price and the type of order.

 
Matutin:
isn't it one of those broker who need to modify order after ordersend() with ordermodify() to set TP and SL due to new rules ?

This is due to using BT bridge (semi 'ECN' broker), not due to new rules.

 
Matutin:
isn't it one of those broker who need to modify order after ordersend() with ordermodify() to set TP and SL due to new rules ?

No, MIG do permit SL and TP to be set in the OrderSend().


CB

 
gordon:

The '[tp]', '[sl]' comments r broker specific. Some have them, some don't.

U can check if order close price is above/bellow open price and the type of order.

This is the same as the OrderProfit function, but not what I need. You can close an order by TakeProfit in positive or in negative (if you change the TakeProfit later).


What I need is to know than an order has been closed by TakeProfit or StopLoss, and without this comment I think it's not possible.


I could compare the close price with the intial TakeProfit price, but it could be imprecise due to slipagge?


Thanks for your replies.

 
NablaQuant:

You can close an order by TakeProfit in positive or in negative (if you change the TakeProfit later).

Good point.


I could compare the close price with the intial TakeProfit price, but it could be imprecise due to slipagge?

U can check if MathAbs(closeprice - tp) > MathAbs(closeprice - sl)

 
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
 
seems the only way... thanks!
 
NablaQuant:
seems the only way... thanks!

Don't know if it helps or not but, in addition to doing what CB is suggesting, I also right-pad my order comments with spaces so that the broker doesn't overwrite anything important in them. Not fail-safe, but I like it as an extra protection in case the external data file somehow went missing.

 

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...?
Reason: