How do I get Open[0], High[0], Low[0], Close[0], not only for the symbol attached bot for all symbols?

 

Hi,

I'm working on a code that loops through all the symbols available and do some data processing. Here, as example, I’m writing to file the current prices of the new incoming Tick:

int start()
  {
   int Handle=FileOpen(fName, FILE_CSV|FILE_WRITE, ';');
   for ( i=0;i<cntCrx;i++) {
      string Crx=CrossList[i];      
      FileWrite(Handle,Crx , MarketInfo(Crx,MODE_TIME) , MarketInfo(Crx,MODE_ASK) , MarketInfo(Crx,MODE_BID),  MarketInfo(Crx,MODE_HIGH) , MarketInfo(Crx,MODE_LOW));
   }
   FileClose(Handle);
   return(0);
  }

I run the code as an EA attaching it to whatever symbol (not important which one, because I'm not use that symbol actually, but I loop through all symbols), and I choose the Bar length to M1 or H1.

Actually, instead of ASK and BID, I would need to know and log the Open[0], Close[0], High[0] and Low[0] of the last closed bar.

During execution of course I could use the predefined functions Open, Close etc to know the prices of the last bar for the symbol the EA is attached to, but it is not what I need.

Since I need to know that values for all the symbols I’m looping into, not properly the one I’m attached to.

I thought to use MarkedInfo, which provides MODE_ASK, MODE_BID and even MODE_HIGH and MODE_LOW… but that refers to High and Low of the day not of the last Bar, and also does not provide Open and Close.

 Any idea?

Thanks

 

 

you can use iOpen(), iClose(), iHigh() and iLow() functions.

They take a symbol  and the timeframe.

 

Fred 

 
Try using iOpen(), iClose(), iHigh(), and iLow() to obtain your datasets. 
 

Thanks guys, sorry for the stupid question... my fault not finding it in the documentation before bothering you!

Reason: