Initial Commit.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# ArrayIsSeries
|
||||
|
||||
The function checks whether an array is a timeseries.
|
||||
|
||||
```
|
||||
bool ArrayIsSeries(
|
||||
const void& array[] // checked array
|
||||
);
|
||||
|
||||
```
|
||||
|
||||
Parameters
|
||||
|
||||
array[]
|
||||
|
||||
[in] Checked array.
|
||||
|
||||
Return Value
|
||||
|
||||
It returns true, if a checked array is an array timeseries, otherwise it returns false. Arrays passed as a parameter to the [OnCalculate()](/en/docs/basis/function/events#oncalculate2) function must be checked for the order of accessing the array elements by [ArrayGetAsSeries()](/en/docs/array/arraygetasseries).
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
#property indicator_chart_window
|
||||
#property indicator_buffers 1
|
||||
#property indicator_plots 1
|
||||
//---- plot Label1
|
||||
#property indicator_label1 "Label1"
|
||||
#property indicator_type1 DRAW_LINE
|
||||
#property indicator_color1 clrRed
|
||||
#property indicator_style1 STYLE_SOLID
|
||||
#property indicator_width1 1
|
||||
//--- indicator buffers
|
||||
double Label1Buffer[];
|
||||
//+------------------------------------------------------------------+
|
||||
//| Custom indicator initialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnInit()
|
||||
{
|
||||
//--- indicator buffers mapping
|
||||
SetIndexBuffer(0,Label1Buffer,INDICATOR_DATA);
|
||||
//---
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| Custom indicator iteration function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnCalculate(const int rates_total,
|
||||
const int prev_calculated,
|
||||
const datetime &time[],
|
||||
const double &open[],
|
||||
const double &high[],
|
||||
const double &low[],
|
||||
const double &close[],
|
||||
const long &tick_volume[],
|
||||
const long &volume[],
|
||||
const int &spread[])
|
||||
{
|
||||
//---
|
||||
if(ArrayIsSeries(open))
|
||||
Print("open[] is timeseries");
|
||||
else
|
||||
Print("open[] is not timeseries!!!");
|
||||
//--- return value of prev_calculated for next call
|
||||
return(rates_total);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
See also
|
||||
|
||||
[Access to timeseries and indicators](/en/docs/series)
|
||||
Reference in New Issue
Block a user