Hello,
Could someone please tell me if this code I have added to an EA to prevent orders being taken if the spread exceeds 2 pips is correct?
All help greatly appreciated
extern double MaxSpread = 2.0;
double spread = MarketInfo(Symbol(), MODE_SPREAD);
then I added this code to the existing Buy/Sell enter orders ( && spread <= MaxSpread )
if (isBuy && !isSell && !(lastType == 1 && spread <= MaxSpread && lastDay == Today())){
if (BuyNow()>0) {
else if(isSell && !isBuy && !(lastType == 2 && spread <= MaxSpread && lastDay == Today())){
if (SellNow()>0) {
Could someone please tell me if this code I have added to an EA to prevent orders being taken if the spread exceeds 2 pips is correct?
All help greatly appreciated
extern double MaxSpread = 2.0;
double spread = MarketInfo(Symbol(), MODE_SPREAD);
then I added this code to the existing Buy/Sell enter orders ( && spread <= MaxSpread )
if (isBuy && !isSell && !(lastType == 1 && spread <= MaxSpread && lastDay == Today())){
if (BuyNow()>0) {
else if(isSell && !isBuy && !(lastType == 2 && spread <= MaxSpread && lastDay == Today())){
if (SellNow()>0) {