How do I refer to a stop loss if the stop loss is achieved

 
if the stop loss happen i will open position again ...
how to write this code
if (OrderClosePrice() == OrderStopLoss()) // is not working

is not working

 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
 
  1. Doubles are rarely equal. Understand the links in:
              The == operand. - MQL4 programming forum #2 2013.06.07

  2. A SL becomes a market order when hit. Therefor the close price will almost never be the SL due to slippage.

  3. You can not use any Trade Functions until you first select an order.

  4. Closed by SL when close price is closer to the SL than the TP.

 
Youssef Ibrahim Abbas Mohammed Saleh:
if the stop loss happen i will open position again ...
how to write this code

is not working

OrderProfit() < 0
 
Iurii Tokman:

Thanks ..... But it did't work  .... this close if OrderProfit <0 ...... this if the profit -0.01 it will closed 

my stop loss is (500).

i need if the stop loss happens

 
Youssef Ibrahim Abbas Mohammed Saleh:

Thanks ..... But it did't work  .... this close if OrderProfit <0 ...... this if the profit -0.01 it will closed 

my stop loss is (500).

i need if the stop loss happens

if(NormalizeDouble(MathAbs(OrderClosePrice()-OrderStopLoss()),Digits())<Point())return(true);
 
Iurii Tokman:

Thank you v much , this work :)

But if the Profit happened word too

 
Youssef Ibrahim Abbas Mohammed Saleh:

Thank you v much , this work :)

But if the Profit happened word too

yes

 
Iurii Tokman:

Sorry this code work in a two type ( stop loss , take profit ) both 

when a stop loss happens is work good

And when the take profit happens it is work also :(

if you have a correct code work for stop loss only

and i'm very happy because you helping  me 

 

You can check with OrderComment since if a stop loss has occured the "[sl]" is normally added there

if(StringFind(OrderComment(),"[sl]",0)!=-1)
{
// SL is hit
}
 
Nikolay Georgiev:

You can check with OrderComment since if a stop loss has occured the "[sl]" is normally added there

Thanks for your help but this code didn't work

Reason: