Problem with Time series functions

 

Hello all

1- I need to access data in lower time frames but when I use iBars(), that returns the value of 0; I have imported history data in to terminal from Tools menu. What else should I do?

2- Is it possible to use data from server without manually importing them? I mean something like 1 minute data on a chart which we don't need to import. but I don't want to open a sperate chart.

3-I will be grateful if any body gives a link to an accurate data source of year 2005 in 1 minute fram.

Thanks

 
see description https://docs.mql4.com/series and sample for ArrayCopySeries.

If You have no data then You will get last 512 bars automatically.
If You have some old data You will get all data between old data and present automatically too.
If You have some old data and need oldest data then You can download oldest data manually only.
 
I had a problem recently with iTime returning 0. My problem was the I was going past the end of the data (back into history) with the Strategy Tester. Could you be calling iBars on the very first bar of the data (via Strategy Tester) and thus there are 0 bars to the left of your current position?

Daniel

AR78 wrote:

Hello all

1- I need to access data in lower time frames but when I use iBars(), that returns the value of 0; I have imported history data in to terminal from Tools menu. What else should I do?

2- Is it possible to use data from server without manually importing them? I mean something like 1 minute data on a chart which we don't need to import. but I don't want to open a sperate chart.

3-I will be grateful if any body gives a link to an accurate data source of year 2005 in 1 minute fram.

Thanks

 

Thanks both,

and should I use ArrayCopySeries every time?

 
Yes
 
Hello
Thanks for your answers. but I can't proceed yet. forgive me for too many questions below:

1- I can't find any relation between ArrayCopySeries and time series functions. should I initialize standard arrays? could you pleasegive me a few lines of example code?

2- What do you mean by having some old data? should I have them in my history? My broker gives 1m data from beginning of this year. cant I use all of that without any other provisions? can't I control how many bars to import?

3- When I want to use some imported data, what should I do? assume 1m data of 2005. how can I get them inside of my scripts? and how can I use them in conjuction with data from my server (starting from beginning of this year, totally from beginning of 2005 to now)?

many thanks in advance.
 
Plus

If I need more than 1 symbol/period serie, should I do initialization (or what ever it is...) every time? or should I keep the data in user defined arrays?

thanks
 
1. ArrayCopySeries provide array accessing (array functions and [] operator) to some time-series. Timeseries functions provide direct access to each element. Don't need initialize array before ArrayCopySeries using

2. You can collect history data. Today your broker gives 1m data for 6 months (from this year beginning). In the next year broker will provide You 6 months of 1m data too. You can set max bars in history with very big number and your data still stored after few years

3. You can import 1m data to 1m history only. Tools - History Center - Import button (first read help)
 
AR78 wrote:
Plus

If I need more than 1 symbol/period serie, should I do initialization (or what ever it is...) every time? or should I keep the data in user defined arrays?

thanks
ArrayCopySeries needed for another history data. For current chart's symbol/period just use Time[],Close[],High[] etc
 

Hello stringo

Can you please tell me what I’ve done wrong with this piece of code?

#property library
 
 
 
//----------------------------------------------------------------------------------------------
 
datetime StartTime=D'2006.07.20 00:00';
 
datetime EndTime=D'2006.07.23 00:00';
 
 
 
//----------------------------------------------------------------------------------------------
 
static datetime Time1m[];
 
static double High1m[];
 
static double Low1m[];
 
 
 
//----------------------------------------------------------------------------------------------
 
void InitSymbol(string SymbolName)
 
{
 
   ArrayCopySeries(Time1m,MODE_TIME,SymbolName,PERIOD_M1);
 
 
 
   int error;
 
   ArrayCopySeries(Time1m,MODE_TIME,SymbolName,PERIOD_M1);
 
   error=GetLastError();
 
   if(error==4066)
 
     {
 
      for(int i=0;i<2; i++)
 
        {
 
         Sleep(5000);
 
         ArrayCopySeries(Time1m,MODE_TIME,SymbolName,PERIOD_M1);
 
        }
 
     }
 
   ArrayCopySeries(High1m,MODE_HIGH,SymbolName,PERIOD_M1);
 
   ArrayCopySeries( Low1m,MODE_LOW ,SymbolName,PERIOD_M1);
 
   
 
   if(StartTime<Time1m[ArraySize(Time1m)])
 
      StartTime=Time1m[ArraySize(Time1m)];
 
   
 
   if(EndTime>Time1m[0])
 
      EndTime=Time1m[0];
 
      
 
  Alert("End=" ,TimeToStr(Time1m[ArraySize(Time1m)]),", Zero=", TimeToStr(Time1m[0]),", " ,ArraySize(Time1m) );
 
   
 
}


I assumed to see beginning and end date of history but I received this alert:

End=1970.01.01 00:00, Zero=1970.01.01 00:00, 0

I have history data in my History center from 2006.01.09 09:37 to 2006.07.26 21:13 for EUR/GBP pair and no data for other pairs. But in neither cases I receive reasonable data.

 
1. Check presence EURGBP in the market watch window
2. First ArrayCopySeries call is unnecessary
Reason: