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

 

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);

}

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

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

...
...
...  
 
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.
 
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
     }
 
int spread = (Ask - Bid) / Point
 

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

 
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
Reason: