How to capture data till last minute using MQL5?

 

I am willing to capture the complete data of 1 year till the last minute today. How it can be possible? I tried it using the strategy tester but it is missing the current day. I am getting the PERIOD_M1 data using the strategy tester.  

Kindly, help me in understanding.

 

What do you mean by capture?

You can just use the regular functions,

iOpen(...
iHigh(...
iLow(...
iClose(...

Where 

iTime(... 

Will reveal the bar time.

Example:

input int shift=0; 
//+------------------------------------------------------------------+ 
//| Function-event handler "tick"                                    | 
//+------------------------------------------------------------------+ 
void OnTick() 
  { 
   datetime time  = iTime(Symbol(),Period(),shift); 
   double   open  = iOpen(Symbol(),Period(),shift); 
   double   high  = iHigh(Symbol(),Period(),shift); 
   double   low   = iLow(Symbol(),Period(),shift); 
   double   close = iClose(NULL,PERIOD_CURRENT,shift); 
   long     volume= iVolume(Symbol(),0,shift); 
   int      bars  = iBars(NULL,0); 
  
   Comment(Symbol(),",",EnumToString(Period()),"\n", 
           "Time: "  ,TimeToString(time,TIME_DATE|TIME_SECONDS),"\n", 
           "Open: "  ,DoubleToString(open,Digits()),"\n", 
           "High: "  ,DoubleToString(high,Digits()),"\n", 
           "Low: "   ,DoubleToString(low,Digits()),"\n", 
           "Close: " ,DoubleToString(close,Digits()),"\n", 
           "Volume: ",IntegerToString(volume),"\n", 
           "Bars: "  ,IntegerToString(bars),"\n" 
           ); 
  }
 
Marco vd Heijden:

What do you mean by capture?

You can just use the regular functions,

Example:

Thank you sir. But I know these functions. I am able to capture one day less through Strategy Tester, right? I want to capture data for the currently going day. 

For example:-- If I want to capture data from 2018.09.1 to 2018.10.10, then using Strategy Tester I get data till 2018.10.09, as 2018.10.10 is still going on. Hence, I am trying to capture the data of 2018.10.10 till the candles are complete and append to the captured data. But I am not getting how I can capture the data for 2018.10.10.

For example, if current it is 2018.10.10 13:10:00, so I want to capture data till 2018.10.10 13:09:00 or 2018.10.10 13:08:00  will work too.

I am not getting how is this can be done. Please help me.

Latest data can hep in making the neural structure sequential as per my logic. I am trying to make a model for that.
 

You can build your own script/indicator/expert and load it onto a chart.

Why are you trying to use strategy tester to pull realtime data ?

It was not designed for that.

It runs on historic data.

You can build your own script/indicator/expert and load it onto a chart.

 
Marco vd Heijden:

You can build your own script/indicator/expert and load it onto a chart.

Why are you trying to use strategy tester to pull realtime data ?

It was not designed for that.

It runs on historic data.

You can build your own script/indicator/expert and load it onto a chart.

Sir but is it possible to get 3 years or an year candles data for 1 minute using script/indicator/expert? Because I had once read that there are certain limitations on the buffer in MQL5. Isn't it correct? I guess some 10000 candles only can be stored or something like that. I am not able to reproduce the article link, as I forgot. May it is a misconception of mine. Please help me.

Reason: