| double iMAOnArray( |
double array[], int total, int period, int ma_shift, int ma_method, int shift) |
Calculation of the Moving Average on data stored in a numeric array.
Unlike iMA(...), the iMAOnArray function does not take data by symbol name,
timeframe, the applied price. The price data must be previously prepared.
The indicator is calculated from left to right. To access to the array elements as to a series array
(i.e., from right to left), one has to use the ArraySetAsSeries function.
Parameters:
| array[] |
- |
Array with data. |
| total |
- |
The number of items to be counted. 0 means whole array. |
| period |
- |
Averaging period for calculation. |
| ma_shift |
- |
MA shift |
| ma_method |
- |
MA method. It can be any of the Moving Average method enumeration value. |
| shift |
- |
Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). |
Sample:
double macurrent=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,0);
double macurrentslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWMA,0);
double maprev=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,1);
double maprevslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWMA,1);
//----
if(maprev<maprevslow && macurrent>=macurrentslow)
Alert("crossing up");
|