Download MetaTrader 5
To add comments, please log in or register
All activity at MQL5.community is clearly visible. Have a look at the Wall!
fxono
68
fxono 2016.03.15 10:13 

Hi, why SymbolInfoDouble() shows 0 for ask and Bid with all symbols?

string Prices(){
   int total = 1;
   total = SymbolsTotal(0);
   string all = "Time,Open,High,Low,Close,Volume,Ask,Bid|||";
   for(int i=1;i<total;i++)
   {
    string s = SymbolName(i,0);        
    all = all +s+","+iTime(s,0,0)+","+iOpen(s,0,0)+","+iHigh(s,0,0)+","+iLow(s,0,0)+","+iClose(s,0,0)+","+iVolume(s,0,0)+","+SymbolInfoDouble(s,SYMBOL_ASK)+","+SymbolInfoDouble(s,SYMBOL_BID)+"|||";
   }
   return all;
}
fxono
68
fxono 2016.03.15 10:38  

Ok, works.

string Prices(){
   int total = 1;
   total = SymbolsTotal(1);
   string all = "Time,Open,High,Low,Close,Volume,Ask,Bid|||";
   for(int i=1;i<total;i++)
   {
    string s = SymbolName(i,1);         
    all = all +s+","+iTime(s,0,0)+","+iOpen(s,0,0)+","+iHigh(s,0,0)+","+iLow(s,0,0)+","+iClose(s,0,0)+","+iVolume(s,0,0)+","+SymbolInfoDouble(s,SYMBOL_ASK)+","+SymbolInfoDouble(s,SYMBOL_BID)+"|||";
   }
   return all;
}
fxono
68
fxono 2016.03.15 12:13  

Hi,

Now this doesn't work (How refresh function only on per period or OnBar)

It refresh Print every tick Why what is wrong with MT4 and Mql4 ?

string newbar = "";

void OnTick()
{
   if(newbar != Time[0]){          
   newbar = Time[0];
   Print(TimeToStr(Time[0], TIME_DATE|TIME_SECONDS) + " Account equity " + DoubleToString(NormalizeDouble(AccountEquity(),2),2));
   Balance(); 
   }   
}
Alain Verleyen
Moderator
30639
Alain Verleyen 2016.03.15 15:43  
datetime newbar = 0;
fxono
68
fxono 2016.03.15 17:25  

Thanks very much.

Ps. MQL4 can't fit as php, blah.

/
To add comments, please log in or register