'SymbolInfoDouble' - no one of the overloads can be applied to the function call

 

Can someone help me with this ?

double bidPrice = 0.0, askPrice = 0.0, spread = 0.0, point = 0.0;
if(!SymbolInfoDouble(_Symbol, SYMBOL_BID, bidPrice) || !SymbolInfoDouble(_Symbol, SYMBOL_ASK, askPrice) ||
   !SymbolInfoDouble(_Symbol, SYMBOL_SPREAD, spread) || !SymbolInfoDouble(_Symbol, SYMBOL_POINT, point))

Improperly formatted code edited by moderator. Please always use the CODE button (Alt-S) when inserting code.

Code button in editor

 

The "Spread" value is in points, so it is an "Integer" property, not a "Double" property.

For function SymbolInfoInteger()

SYMBOL_SPREAD

Spread value in points

int

Documentation on MQL5: Market Info / SymbolInfoInteger
Documentation on MQL5: Market Info / SymbolInfoInteger
  • www.mql5.com
Returns the corresponding property of a specified symbol. There are 2 variants of the function. 1. Immediately returns the property value. 2...
 
Độ Hà:
Can someone help me with this ?

Try this , you can use the symbol info tick structure 

SymbolInfoTick - Market Info - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
//---
  MqlTick tick_receiver;
  if(SymbolInfoTick(_Symbol,tick_receiver)){
    Print("Got tick");
    double bid=tick_receiver.bid;
    double ask=tick_receiver.ask;
    double point=_Point;
    double spread=(ask-bid);
    int spread_points=(int)MathRound(spread/point);
    }else{
    Print("No tick");
    }
Documentation on MQL5: Market Info / SymbolInfoTick
Documentation on MQL5: Market Info / SymbolInfoTick
  • www.mql5.com
The function returns current prices of a specified symbol in a variable of the MqlTick type. Parameters symbol [in]  Symbol name. tick [out]...
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893