A group of functions intended for access to price data of any available symbol/period. If data (symbol name and/or timeframe differ from the current ones) are requested from another chart, the situation is possible that the corresponding chart was not opened in the client terminal and the necessary data must be requested from the server. In this case, error ERR_HISTORY_WILL_UPDATED (4066 - the requested history data are under updating) will be placed in the last_error variable, and one will has to re-request (see example of ArrayCopySeries()).
At the testing, price data of the same symbol but of another timeframe are modelled exactly, with the exception of volumes. Volumes of another timeframe are not
modelled. Price data of other symbols are not modelled, either. In all cases, the amount of bars in time series is modelled exactly.
IBARS
int iBars( string symbol, int timeframe)
Returns the number of bars on the specified chart.
For the current chart, the information about the amount of bars is in the predefined variable named Bars.
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL
means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe. Sample:
Print("Bar count on the 'EUROUSD' symbol with PERIOD_H1 is",iBars("EUROUSD",PERIOD_H1));
IBARSHIFT
int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)
Search for bar by open time. The function returns bar shift with the open time specified. If the bar having the specified open time is missing, the function will return -1 or the nearest bar shift depending on the exact.
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL
means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe.
time - value to find (bar's open time).
exact - Return mode when bar not found. false - iBarShift returns nearest. true -
iBarShift returns -1. Sample:
datetime some_time=D'2004.03.21 12:00';
144
Print("shift of bar with open time ",TimeToStr(some_time)," is ",shift);
ICLOSE
double iClose( string symbol, int timeframe, int shift)
Returns Close value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
For the current chart, the information about close prices is in the predefined array named Close[].
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL
means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe.
shift - Index of the value taken from the indicator buffer (shift relative to the
current bar the given amount of periods ago). Sample:
Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,i),", ", iOpen("USDCHF",PERIOD_H1,i),", ", iHigh("USDCHF",PERIOD_H1,i),", ", iLow("USDCHF",PERIOD_H1,i),", ", iClose("USDCHF",PERIOD_H1,i),", ", iVolume("USDCHF",PERIOD_H1,i)); IHIGH
double iHigh( string symbol, int timeframe, int shift)
Returns High value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
For the current chart, the information about high prices is in the predefined array named High[].
Parameters:
symbol - Symbol on that data need to calculate indicator. NULL means current
symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe.
shift - Index of the value taken from the indicator buffer (shift relative to the
current bar the given amount of periods ago). Sample:
Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,i),", ", iOpen("USDCHF",PERIOD_H1,i),", ", iHigh("USDCHF",PERIOD_H1,i),", ", iLow("USDCHF",PERIOD_H1,i),", ", iClose("USDCHF",PERIOD_H1,i),", ", iVolume("USDCHF",PERIOD_H1,i)); IHIGHEST
145
iHighest( int start=0)
Returns the shift of the maximum value over a specific number of periods depending on type.
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL
means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe.
type - Series array identifier. It can be any of the Series array identifier
enumeration values.
count - Number of periods (in direction from the start bar to the back one) on
which the calculation is carried out.
start - Shift showing the bar, relative to the current bar, that the data should be
taken from. Sample:
double val;
// calculating the highest value on the 20 consequtive bars in the range
// from the 4th to the 23rd index inclusive on the current chart val=High[iHighest(NULL,0,MODE_HIGH,20,4)];
ILOW
double iLow( string symbol, int timeframe, int shift)
Returns Low value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
For the current chart, the information about low prices is in the predefined array named Low[].
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL
means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe.
shift - Index of the value taken from the indicator buffer (shift relative to the
current bar the given amount of periods ago). Sample:
Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,i),", ", iOpen("USDCHF",PERIOD_H1,i),", ", iHigh("USDCHF",PERIOD_H1,i),", ", iLow("USDCHF",PERIOD_H1,i),", ", iClose("USDCHF",PERIOD_H1,i),", ", iVolume("USDCHF",PERIOD_H1,i)); ILOWEST int iLowest(
string symbol, int timeframe, int type, int count=WHOLE_ARRAY,
int start=0)
Returns the shift of the least value over a specific number of periods depending on type. Parameters:
146
symbol - Symbol the data of which should be used to calculate indicator. NULL
means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe.
type - Series array identifier. It can be any of Series array identifier
enumeration values.
count - Number of periods (in direction from the start bar to the back one) on
which the calculation is carried out.
start - Shift showing the bar, relative to the current bar, that the data should be
taken from. Sample:
// calculating the lowest value on the 10 consequtive bars in the range
// from the 10th to the 19th index inclusive on the current chart double val=Low[iLowest(NULL,0,MODE_LOW,10,10)];
IOPEN
double iOpen( string symbol, int timeframe, int shift)
Returns Open value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
For the current chart, the information about open prices is in the predefined array named Open[].
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL
means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe.
shift - Index of the value taken from the indicator buffer (shift relative to the
current bar the given amount of periods ago). Sample:
Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,i),", ", iOpen("USDCHF",PERIOD_H1,i),", ", iHigh("USDCHF",PERIOD_H1,i),", ", iLow("USDCHF",PERIOD_H1,i),", ", iClose("USDCHF",PERIOD_H1,i),", ", iVolume("USDCHF",PERIOD_H1,i)); ITIME
datetime iTime( string symbol, int timeframe, int shift)
Returns Time value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
For the current chart, the information about bars open times is in the predefined array named Time[].
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL
147
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe.
shift - Index of the value taken from the indicator buffer (shift relative to the
current bar the given amount of periods ago). Sample:
Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,i),", ", iOpen("USDCHF",PERIOD_H1,i),", ", iHigh("USDCHF",PERIOD_H1,i),", ", iLow("USDCHF",PERIOD_H1,i),", ", iClose("USDCHF",PERIOD_H1,i),", ", iVolume("USDCHF",PERIOD_H1,i)); IVOLUME
double iVolume( string symbol, int timeframe, int shift)
Returns Tick Volume value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.
For the current chart, the information about bars tick volumes is in the predefined array named Volume[].
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL
means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means
the current chart timeframe.
shift - Index of the value taken from the indicator buffer (shift relative to the
current bar the given amount of periods ago). Sample:
Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,i),", ", iOpen("USDCHF",PERIOD_H1,i),", ",
iHigh("USDCHF",PERIOD_H1,i),", ", iLow("USDCHF",PERIOD_H1,i),", ",
iClose("USDCHF",PERIOD_H1,i),", ", iVolume("USDCHF",PERIOD_H1,i));
148