Return value of the Stochastic oscillator %K line over N periods of the selected price serie.
Syntax:
1 |
Stochastic[N,K](price1,price2,price3) |
Calculation :
The first parameter is the number of days used to calculate %K, the second is the number of days to be considered for the moving average of %K (generally 1 for Fast Stochastic and 3 or 5 for Slow Stochastic), the third is the number of days to be considered for the moving average of %D.
“price1”, “price2” and “price3” are optional. By default the stochastic will be calculated with Close on the High/Low scale (same as the internal platform indicator). But you can adjust it with any other price or data series (e.g. Stochastic[N,K](close,close,close) or Stochastic[N,K](var1,var2,var3) )
Interpretation :
It is an overbought/oversold indicator depending on its position relative to the 0 level.
Is also gives good divergence signals.
A bullish divergence occurs when the stock price makes new lows while the stochastic fails to make new lows.
A bearish divergence occurs when the stock price makes new highs while the Stochastic fails to make new highs.
Example 1:
1 2 3 4 5 6 7 8 9 10 11 |
sto = Stochastic[10,3](close) signal = average[5](sto) if(sto>80 AND sto[1]>signal[1] AND sto<signal) THEN overboughtSignal = 1 ELSE overboughtSignal = 0 ENDIF RETURN overboughtSignal |
Example 2: (stochastic of RSI)
1 2 3 4 5 |
irsi=rsi[14] isto = Stochastic[14,3](irsi,highest[20](irsi),lowest[20](irsi)) return isto |
How would you code a stochastic with an 8-3-3 setting? I only see two parameters, not three.
The third parameter is the average period of the signal line (the stochastic that is smoothed). So it is indeed not needed to calculate the stochastic.
Ciao, the posted code doesn’t show anything on price, just an histogram of positive and negative, i applied a modify to the code and if you put it on price that will show with different color the signal candle
sto = Stochastic[Periodi,K](close)
signal = average[D](sto)
if(sto>80 AND sto[1]>signal[1] AND sto<signal) THEN
//overboughtSignal = 1
BACKGROUNDCOLOR (R,V,B,a)
ELSE
//overboughtSignal = 0
BACKGROUNDCOLOR (0,0,0,0)
ENDIF
return
The definition given is for a daily stochastic. not accurate for a stochastic that would be calculated on 1 hour bars.
Right, “days” should be replaced by “periods”.
Il semblerait que :
sto = Stochastic[10,3](close)
N =20
x = sto[N] retourne n/d au lieu de la stochastique 20 mme bougie correct ?
It Seems that :
sto = Stochastic[10,3](close)
N =20
x = sto[N] returns n/d instead of the value of the 20th candle before….
La syntaxe est correcte. Sous quelle version ce problème existe-t’il ?