Calculates the Envelopes indicator on data stored in an array.

Function Signature

double iEnvelopesOnArray( double array[], // Array with data int total, // Number of elements (0 for whole array) int ma_period, // MA averaging period int ma_method, // MA averaging method (ENUM_MA_METHOD) int ma_shift, // MA shift double deviation, // Deviation in percent int mode, // Indicator line index (MODE_MAIN, MODE_UPPER, MODE_LOWER) int shift // Shift relative to current bar );

Parameters

  • array[]: Input array containing the price data.
  • total: The number of elements to consider from the array. If 0, the entire array is used.
  • ma_period: The period for calculating the Moving Average (MA) of the main line.
  • ma_method: The method used for the Moving Average calculation. Refer to ENUM_MA_METHOD for possible values.
  • ma_shift: An offset applied to the Moving Average line.
  • deviation: The deviation from the main line, specified as a percentage.
  • mode: Specifies which indicator line to return. Can be MODE_MAIN (0), MODE_UPPER (1), or MODE_LOWER (2).
  • shift: The index of the data point to retrieve from the indicator buffer, relative to the current bar.
  • Return Value

    A double representing the calculated value of the Envelopes indicator for the specified line and shift.

    Notes

  • Unlike iEnvelopes(), this function operates on pre-prepared data arrays and does not require symbol, timeframe, or applied price parameters.
  • The indicator is calculated from left to right. For right-to-left access, use ArraySetAsSeries().
  • Related Functions

  • iEnvelopes()
  • ArraySetAsSeries()
  • Constants

  • ENUM_MA_METHOD: Enumeration for MA calculation methods.
  • MODE_MAIN, MODE_UPPER, MODE_LOWER: Line identifiers for indicator buffers.