Download MetaTrader 5
To add comments, please log in or register
Do you need private account monitoring? The Signals will provide you one!
Weixing Meng
201
Weixing Meng 2016.02.05 19:47 

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!

Keith Watford
Moderator
7985
Keith Watford 2016.02.05 23:07  

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

ie SL*Point 

Weixing Meng
201
Weixing Meng 2016.02.14 02:37  
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!
/
To add comments, please log in or register