Download: STOCH-CLASSIC.ELA
Category: Indicator > Oscillators
Description:
The Stochastic Classic indicator calculates the location of a current price in relation to its range over a period of bars. The default settings are to use the most recent 3 bars (input KAdjust), the high and low of that period to establish a range and the close as the current price.
This calculation is then indexed and averaged for the most recent 5 bars, specified in the input Length. This value is plotted as %K. The value %D is a 5 bar average of a smoothed %K. %K and %D plot as oscillators with values from 0 to 100.
Usage:
The direction of the Stochastics should confirm price movement. For example, rising Stochastics confirm rising prices.
Stochastics can also help identify turning points when there are non-confirmations or divergences. For example, a new high in price without a new high in Stochastics may indicate a false breakout. Stochastics are also used to identify overbought and oversold conditions when the Stochastics reach extreme highs or lows. Additionally, %K crossing above the smoother %D can be a buy signal and vice versa.
Inputs:
Length - Number of bars of Stochastic values to average
KAdjust - Number of bars used to calculate %K
DAdjust - Number of bars used to calculate %D
OverBought - %K level considered overbought
OverSold - %K level considered oversold
EasyLanguage Code:
INPUT: LENGTH(5), KADJUST(3), DADJUST(3), OVERBOUGHT(80), OVERSOLD(20);
VARIABLES: KADJUSTED(0), DADJUSTED(0);
KADJUSTED = SLOWKCLASSIC(KADJUST, LENGTH);
DADJUSTED = SLOWDCLASSIC(DADJUST, LENGTH);
IF CURRENTBAR > LENGTH THEN BEGIN
PLOT1(KADJUSTED, "%K");
PLOT2(DADJUSTED, "%D");
END;
PLOT3(OVERBOUGHT, "OVERBOUGHT");
PLOT4(OVERSOLD, "OVERSOLD");
{ALERT CRITERIA}
IF PLOT1 > OVERBOUGHT THEN
ALERT("THE %K LINE IS IN OVERBOUGHT TERRITORY")
ELSE
IF PLOT1 < OVERSOLD THEN
ALERT("THE %K LINE IS IN OVERSOLD TERRITORY");