Download MetaTrader 5
To add comments, please log in or register
Publish your programs in the Market. Make money with your knowledge!
Lovro Mirnik
54
Lovro Mirnik 2015.02.15 11:16 

Hello fellow Traders,

would this be the correct way to calculate spread?

double BidPN; //Bid Price New
double AskPN; //Ask Price New
double SpreadC;

void OnTick()
   {
      BidPN = Bid;
      AskPN = Ask;
      SpreadC = MathAbs(AskPN - BidPN);
   }
Carl Schreiber
5940
Carl Schreiber 2015.02.15 12:20  
You don't need MathAbs(Ask-Bid) as some brokers proudly presents their occasionally appearing negative spreads.
Alain Verleyen
Moderator
28551
Alain Verleyen 2015.02.15 14:30  
lovromirnik:

Hello fellow Traders,

would this be the correct way to calculate spread?

Or

SymbolInfoInteger(_Symbol,SYMBOL_SPREAD);

or

MarketInfo(_Symbol,MODE_SPREAD);
Lovro Mirnik
54
Lovro Mirnik 2015.02.15 20:41  
Thank you both for replying and confirming my code.
/
To add comments, please log in or register