Download MetaTrader 5

EA executing weird shorts despite spread protection

To add comments, please log in or register
bagostra
35
bagostra  

extern double MaxSpreadAllowed = 2;

double Spread;

Spread = (Ask-Bid)*10000;

if(Spread <= MaxSpreadAllowed) {

my broker ***** me here by adding weird shorts during market closing & opening at 10 pips spread.

 

}

i have also tried using this:

Spread = MarketInfo(Symbol(),MODE_SPREAD);

and this: 

Spread = SymbolInfoInteger(NULL,SYMBOL_SPREAD) 

i've also tried using the marketinfo directly in the IF statement.

 i'm not sure what i'm doing wrong here. i tried all the spread protection methods i could find with google.

Keith Watford
Moderator
10645
Keith Watford  

What symbol are you trading on?

Please use polite language when posting. I have edited out your expletive.

bagostra
35
bagostra  
Keith Watford:

What symbol are you trading on?

Please use polite language when posting. I have edited out your expletive.

thank you, i'm trading on multiple symbols.. they all have the same problem 
honest_knave
Moderator
2326
honest_knave  

Does your EA trade multiple symbols from the same chart?

e.g. the EA gets added to a EURUSD chart, but can take trades on other pairs

whroeder1
15934
whroeder1  
bagostra i'm trading on multiple symbols.. they all have the same problem 
But
honest_knave: Does your EA trade multiple symbols from the same chart? e.g. the EA gets added to a EURUSD chart, but can take trades on other pairs
Multiple symbols from the same chart is different (#2) than trading one pair per chart (#1)
  1. Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
  2. This is why I recommend
    Do not trade multiple currencies in one EA
To add comments, please log in or register