MQL4 Reference Timeseries and Indicators Access iOpen

iOpen

Returns Open price value for the bar of specified symbol with timeframe and shift.

double  iOpen(
   string           symbol,          // symbol
   int              timeframe,       // timeframe
   int              shift            // shift
   );

Parameters

symbol

[in]  Symbol name. NULL means the current symbol.

timeframe

[in]  Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.

shift

[in]  Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

Returned value

Open price value for the bar of specified symbol with timeframe and shift or 0 if error. To check errors, one has to call the GetLastError() function.

Note

For the current chart, the information about open prices is in the Open[] predefined array.

Example:

  Print("Current bar for USDCHF H1: ",iTime("USDCHF",PERIOD_H1,0),", ",  iOpen("USDCHF",PERIOD_H1,0),", ",
                                      iHigh("USDCHF",PERIOD_H1,0),", ",  iLow("USDCHF",PERIOD_H1,0),", ",
                                      iClose("USDCHF",PERIOD_H1,0),", "iVolume("USDCHF",PERIOD_H1,0));