Download MetaTrader 5

don't trade if spread is high...pls assistance

To add comments, please log in or register
chudanever
269
chudanever  

Pls I need assistance on this code,if spread high is...return...No trade..But the problem is

return (0) is added on the EA code it will not open any order again,but is I remove it

Will start working again without regulating the high spread,this is the code..Any corrects pls.thanks




double Spread = Ask-Bid;
if(Spread >= 5 * digit (5digit broker calculated here)
{ return(0);

}

chudanever
269
chudanever  
Pls anyone with this code is not working on my EA..Any correction pls
Osama Shaban
1615
Osama Shaban  
input int MaximumSpread = 35;

Spread = MarketInfo(Symbol(),MODE_SPREAD);
  
if(ma=="BUY" && rsi=="BUY" && Spread<=MaximumSpread && ... && ...)
   OpenBuy();

...
...
...  
whroeder1
16076
whroeder1  
chudanever: this code is not working
  1. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  2. Print out your variables, and find out why.
Donald Gibson
494
Donald Gibson  
chudanever:

Pls I need assistance on this code,if spread high is...return...No trade..But the problem is

return (0) is added on the EA code it will not open any order again,but is I remove it

Will start working again without regulating the high spread,this is the code..Any corrects pls.thanks




double Spread = Ask-Bid;
if(Spread >= 5 * digit (5digit broker calculated here)
{ return(0);

}


   double Spread=MarketInfo(Symbol(),MODE_SPREAD);
   Print("Spread   "+DoubleToStr(Spread,Digits));
   if(Spread>5)
     {
      // Whatever code you choose for spread lower than 5
     }
2610131420709
5
2610131420709  
int spread = (Ask - Bid) / Point
chudanever
269
chudanever  

Thanks you all your corrections and assistance,you guys are really helpful,I will try it @ Donald Gibson though I latter get spread info but I think it more

Clean here..I will try it later thanks all again

chudanever
269
chudanever  
whroeder1:
  1. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  2. Print out your variables, and find out why.

Thanks whroeder for the link
To add comments, please log in or register