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


Public Function StochasticOScillator(chart_ID As Long, PeriodK As Integer, SlowingK As Integer, PeriodD As Integer, Ma As ENUM_MA_METHOD) As String 


The Stochastic Oscillator is a popular indicator that shows where a security’s price has closed in proportion to its closing price range over a specified period of time.

The Stochastic Oscillator has two components: %K and %D. %K is most often displayed as a solid line and %D is often shown as a dotted line.

The most widely used method for interpreting the Stochastic Oscillator is to buy when either component raisesabove 80 or sell when either component falls below 20.

Another way to interpret the Stochastic Oscillator is to buy when %K raises above %D, and conversely, sell when %K falls below %D.


Key Description 
chart_ID Chart identifier, 0 is the current chart, a value of type Long.
PeriodK The first calculation period, on which first moving average indicator will be calculated, a value of type Integer.
SlowingK The moving average slowing value, a value of type Integer.
PeriodD The second calculation period, on which second moving average indicator will be calculated, value of type Integer.
MA The moving average type, a value of type  ENUM_MA_METHOD.

Return value

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


Public Sub main()

AlertMessage (StochasticOScillator(0,10,3,3,0))

'Draws the indicator on the chart and 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