How to return new SL - page 2

 
Sonima:

Hello again, thanks for your reply.

As I mentioned, this a part of the code and except those two problems, it works fine.

I update the code in the above post (my bad).

The code you posted

  • does manage BUY and SELL the same way. Is this what you want?
  • The very moment the SL moves 1 point below OrderOpenPrice(), the SL will be modified if the broker STOP_LEVEL distance is zero. Otherwise will fail
  • You are not evaluating the errors from OrderSelect() and OrderModify 
You need to add a safety distance from OrderOpenPrice() to trigger the SL change which should be larger than STOP_LEVEL + spread 

 
Fernando Morales:

The code you posted

  • does manage BUY and SELL the same way. Is this what you want?
  • The very moment the SL moves 1 point below OrderOpenPrice(), the SL will be modified if the broker STOP_LEVEL distance is zero. Otherwise will fail
  • You are not evaluating the errors from OrderSelect() and OrderModify 
You need to add a safety distance from OrderOpenPrice() to trigger the SL change which should be larger than STOP_LEVEL + spread 

Hi!

You are right, but my question is about BE and Old_ClosePrice!

I want to return closeprice (in this case) to the "Old_ClosePrice" and change the BE from false to true.

Reason: