The “onChart Stochastic” indicator plots a stochastic oscillator directly overlaid on the price chart.
The price range of the stochastic is calculated with the daily Average True Range of the last 20 periods (days).
This price range is then applied centered over a moving average on price. Consequently, the overbought and oversold levels are the upper and lower bands of the channel. By using this kind of approach, any bounded oscillator could be applied on the price chart, like the way this indicator does (RSI, CCI, etc.).
Converted from a MT4 indicator by a request in the English forum.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
//PRC_OnChart Stochastic | indicator //23.05.2018 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge // --- settings KPeriod = 26 Slowing = 5 DPeriod = 5 ATRperiod = 20 maPeriod = 20 maMethod = 0 overBought = 80 overSold = 20 // --- end of settings maPrice = customclose dTR = 0 for i = 0 to ATRperiod-1 dTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1)))) next avgRange = dTR/ATRperiod maValue = average[maPeriod,maMethod](maPrice) stochValue = Stochastic[Kperiod,Slowing](maPrice) signalValue = average[Dperiod,maMethod](stochValue) //---- Buffer1=maValue Buffer2=maValue+(avgRange*(overBought-50)/100) Buffer3=maValue-(avgRange*(50- overSold)/100) Buffer4=maValue+(stochValue -50)/100*avgRange Buffer5=maValue+(signalValue-50)/100*avgRange return Buffer1 coloured(102,0,0) style(dottedline,1) as "mid level", Buffer2 coloured(102,0,0) style(dottedline,1) as "overbought level", Buffer3 coloured(102,0,0) style(dottedline,1) as "oversold level", Buffer4 coloured(0,255,0) style(line,2) as "OnChart stochastic", Buffer5 coloured(255,0,0) style(line,2) as "Signal line" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Dear Nicolas, what are the recommended settings for the daily chart?
Hola Nicolas A ver cogiendo tus conocimientos he realizado un nuevo codigo no con uno sino con dos osciladores asi me permite programar mi Sistema de trenes (que explico en el codigo) sin embargo como casi siempre hasta que aprenda mas algo no hago bien y no dibuja las flechas de entrada y salida Este Sistema llamado de “Trenes” da trades de altisima probabilidad y con mas del 85 % de aciertos
He colgado un nuevo codigo a partir de tu codigo pero veo que no aparece lo he hecho con el añadir codigo PRT pero no sale
Ya se que soy un desastre pero prometo que un dia aprendere jajajajaaj https://www.screencast.com/t/IeQ1Bpca
Ya esta lo he conseguido estas son las imagenes https://www.screencast.com/t/upBvffuN ademas ahora se pueden cambiar tanto los parametros de los dos osciladores como la media mobil si se pone en 100 o en 200 ademas la linea discontinua de puntos azul es el eje de los estocasticos y al mismo tiempo esta media movil muy bueno el indicador Nicolas
great work!
Hi I can’t visualize the indicator on the chart? can anybody help me, please?
Add it on price using the wrench on the left upper side of the price chart.
thanks Nicolas, I’ ll try again!
Buongiono e grazie :
l’immagine sopra ritrae l’indicatore sul TF 15 min ma a me funziona solo DAY e H1
per il 15 min / 5 min devo apportare qualche modifica ???
grazie