I tried the mt5 TradeClass today ,Why I can't get the Ask price?
Add this in your code:
mysymbol.RefreshRates();
Add this in your code:
#include <Trade\SymbolInfo.mqh>
CSymbolInfo mysymbol;
//+------------------------------------------------------------------+
//| Script program start function |
mysymbol.RefreshRates();
//+------------------------------------------------------------------+
void OnStart()
{
double Ask=mysymbol.Ask();
Print("Ask is : ",Ask);
}
Where should I add it, like this ? :-D
Ha! Point taken.
:-D
void OnStart() { mysymbol.RefreshRates(); double Ask=mysymbol.Ask(); Print("Ask is : ",Ask); }
Ha! Point taken.
:-D
#include <Trade\SymbolInfo.mqh>
CSymbolInfo mysymbol;
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
double Ask=mysymbol.Ask();
Print("Ask is : ",Ask);
}
print result is 0.0, I don't know why? maybe I missed something?
thanks your reply,,,