How To Set Stop Loss ?

 

The first EA I'm trying to understand, is the MT4 Example EA of Moving Average. 

A quite simple one, now I finally understand it. Now I'm trying to add stop loss to this EA. Only a practice.

But always failed.

What's wrong with my stop loss, it should be like a number like 300 points stop loss, or like (open price)±300  

See the following, it doesn't work  T.T! HELP!!Thank you a looooooot!!

//--- sell conditions
   if(Open[1]>ma1 && Close[1]<ma1 && ma1<ma)
     {
      res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,SP,iHigh(0,0,0)+SL,0,"",MAGICMA,0,Red);
      return;
     }
//--- buy conditions
   if(Open[1]<ma1 && Close[1]>ma1 && ma1>ma)
     {
      res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,SP,iHigh(0,0,0)-SL,0,"",MAGICMA,0,Blue);
      return;
     }

 T.T!Please also teach me about setting Take Profit……Thank You!

 

if SL is 300 points then you need to convert it to a decimal

ie SL*Point 

 
GumRai:

if SL is 300 points then you need to convert it to a decimal

ie SL*Point 

Finally I set SL successfully……Thank You!
Reason: