Envelopes Formula (Chart Controls)

The envelopes formula calculates "envelopes" above and below a moving average using a specified percentage as the shift. The envelopes indicator is used to create signals for buying and selling. You can specify the percentage the formula uses to calculate the envelopes.

Sample plot of the envelopes formula output

Formula Details

Syntax

Chart.DataManipulator.FinancialFormula(
    FinancialFormula.Envelopes,
    "Period,Shift",
    "Price",
    "Upper:Lower")

Parameters

This formula takes two required parameters.

  • Period
    Period for calculating the moving average.
  • Shift
    Percentage used to shift the upper and lower envelopes from the moving.

Input Values

This formula takes one input Y value.

  • Price
    Price for which the envelopes are calculated.

Output Value

This formula outputs two Y values.

  • Upper
    Upper envelope.
  • Lower
    Lower envelope.

Remarks

The Range chart type is a convenient chart type to display the formula output. You can also use the Line chart type to display the upper envelope and lower envelope as two data series.

Example

The following example takes input from Series1's second Y value (Series1:Y2) and outputs a 20-day moving average on Series2 and the 7% envelopes for the moving average on Series3.

' Calculate 20 days Simple moving average.
Chart1.DataManipulator.FinancialFormula (FinancialFormula.MovingAverage, "20", "Series1:Y2", "Series2:Y")

' Calculate 20 days Envelopes with 7 percent shift.
Chart1.DataManipulator.FinancialFormula (FinancialFormula.Envelopes, "20,7", "Series1:Y2", "Series3:Y,Series3:Y2")
// Calculate 20 days Simple moving average.
Chart1.DataManipulator.FinancialFormula (FinancialFormula.MovingAverage, "20", "Series1:Y2", "Series2:Y");

// Calculate 20 days Envelopes with 7 percent shift.
Chart1.DataManipulator.FinancialFormula (FinancialFormula.Envelopes, "20,7", "Series1:Y2", "Series3:Y,Series3:Y2");

See Also

Reference

System.Windows.Forms.DataVisualization.Charting
System.Web.UI.DataVisualization.Charting

Concepts

Financial Formulas
Applying Formulas