Posted by Mohammad Rahhal, Last modified by Diana Alkouni on 14 September 2020 12:39 PM


Public Function MovingAverageEnvelope(chart_ID As Long, applyTo As ENUM_APPLIED_PRICE, period As Integer, Ma As ENUM_MA_METHOD, Shift As Double) As String


Moving Average Envelopes consist of moving averages calculated from the underling price, shifted up and down by a fixed percentage.

Moving Average Envelopes (or trading bands) can be imposed over an actual price or another indicator.

When prices raise above the upper band or fall below the lower band, a change in direction may occur when the price penetrates the band after a small reversal from the opposite direction.


Key Description 
chart_ID Chart identifier, 0 is the current chart ,value of type Long
applyTo Applied price ,value of type  ENUM_APPLIED_PRICE.
Period The calculation period, on which the indicator will be calculated, value of type Integer.
Ma Moving average method , can be one of  ENUM_MA_METHOD.
Shift Horizontal shift of the indicator ,value of type Double.

Return value

Returns the handles of a technical indicator, in case of failure returns a empty string.


Public Sub main()

AlertMessage (MovingAverageEnvelope(0,PRICE_CLOSE,14,0,1.0)) 'Draws the indicator on chart & shows an Alert Message with 'the indicator name.

End Sub

See Also

Back to VTL Client Script Index

(0 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Hybrid Solutions