Stochastic Oscillator
The Stochastic Oscillator compares where a security's price closed relative
to its price range over a given time period.
The Stochastic Oscillator is displayed as two lines. The main line is called
"%K." The second line, called "%D," is a moving average of %K. The %K line is
usually displayed as a solid line and the %D line is usually displayed as a
dotted line.
There are several ways to interpret a Stochastic Oscillator. Three popular
methods include:
- Buy when the Oscillator (either %K or %D) falls below a specific level
(e.g., 20) and then rises above that level. Sell when the Oscillator rises
above a specific level (e.g., 80) and then falls below that level.
- Buy when the %K line rises above the %D line and sell when the %K line
falls below the %D line.
Look for divergences. For example, where prices are making a series of new
highs and the Stochastic Oscillator is failing to surpass its previous highs.
Syntax:
Public Function StochasticOscillator(ByVal HLOCV()() As Double, ByVal Lag As Long, ByVal Slowing As Long) As Double
Parameters:
- ByVal HLOCV()() As Double
- ByVal Lag As Long
- ByVal Slowing As Long
Back to list
Example:
Dim TA4Net As
New TA4Net.CTAFunctions("YOUR-REGISTRATION-CODE")
Dim Result() As
Double
Dim
HLOCV(,) As
Double
' loading values to array
HLOCV =
GetHLOCVValues()
' calculating Technical Analysis function
Result = TA4Net.StochasticOscillator(HLOCV, 14, 10)
|