Stoploss an alternative methods

 

Hi guys,

I am a novist to MQL 4 but I have already coded some EA and testing.

But I am not a professional or expert programmer so I need to an help.

I would like to know how I can set the STOP LOSS for sell and buy market order using a fractal.

I mena I would like to have  a STOPLOSS= fractals.

I tried using this code but it doesn't work: this is the error Testing pass stopped due to a critical error in the EA




double StopLong=iFractals(NULL,0,MODE_LOWER,1);                                     

double StopShort=iFractals(NULL,0,MODE_UPPER,1);  

Then for the open trade

......

 {OrderSend(Symbol(),OP_BUY,.1,Ask,Slippage*Point,StopLong,Ask+TPLong*Point,"EA204080_Long",MagicNumber,0,Blue);}

  ..................

   { OrderSend(Symbol(),OP_SELL,.1,Bid,Slippage*Point,StopShort,Bid-TPShort*Point,"EA204080_Short",MagicNumber,0,Green);}