Can you give an example how to use CiTime class in TimeSeries.mqh file to get open time of a bar?
CiTime
CiTime is a class designed for access to open
times of the bars in the history.
Description
The CiTime class provides an access to open
times of the bars in the history.
Declaration
class CiTime: public CSeries
Title
#include <Indicators\TimeSeries.mqh>
Class Methods
Create
Methods
Create
Creates a
timeseries
BufferResize
Sets buffer size
Data Access
Methods
GetData
Gets the data
Data Update
Methods
Refresh
Updates the
data
//+------------------------------------------------------------------+//| Method to access data. |//| INPUT: index - position of element in the buffer. |//| OUTPUT: value - if successful, 0 otherwise. |//| REMARK: no. |//+------------------------------------------------------------------+datetime CiTime::GetData(int index) const
{
CTimeBuffer *buff=At(0);
//--- checkingif(buff==NULL)
{
Print("CiSpread::GetData: invalid buffer");
return(0);
}
//---return((datetime)buff.At(index));
}
//+------------------------------------------------------------------+//| API access method "Copying the time buffer by specifying |//| start position and number of elements". |//| INPUT: start_pos - position of start element in the buffer, |//| count - number of elements to copy, |//| buffer - reference to a dynamic array of double |//| values. |//| OUTPUT: >=0 if successful, -1 if not. |//| REMARK: no. |//+------------------------------------------------------------------+int CiTime::GetData(int start_pos,int count,datetime& buffer[]) const
{
return(CopyTime(m_symbol,m_period,start_pos,count,buffer));
}
there is another error message, this should be "CiTime::GetData:invalid buffer"
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi Guys,
Can you give an example how to use CiTime class in TimeSeries.mqh file to get open time of a bar?
CiTime
CiTime is a class designed for access to open times of the bars in the history.
Description
The CiTime class provides an access to open times of the bars in the history.
Declaration
class CiTime: public CSeries
Title
#include <Indicators\TimeSeries.mqh>
Class Methods
Create Methods
Create
Creates a timeseries
BufferResize
Sets buffer size
Data Access Methods
GetData
Gets the data
Data Update Methods
Refresh
Updates the data
there is another error message, this should be "CiTime::GetData:invalid buffer"
"CiSpread::GetData: invalid buffer"thrid,
CiTime::GetData(int index)it doesn't work for me.
but this method works.
is there any different?
thanks,