In code, when you want to define conditions based on specific numeric values of RSI or stochastics like %K, how do you express these values? I mean, if you want to say 80% do you type 80 or 0.8 in code? I am a newbie and couldn’t find the answer in the manuals…
Hello,
80
Doc from here can be accessed from “help” menu above, it has terms search: https://www.prorealcode.com/prorealtime-documentation/
Example for RSI, says between 0 and 100: https://www.prorealcode.com/documentation/rsi/
thanked this post
RSI and Stochastic are actually graduated on a percentage scale from 0 to 100, their values are normalized over a period of time.
So 80% of a scale that go from 0 to 100 is 80 🙂
Good morning, I’m trying to do the following and I can’t do it, could someone help me? I am trying to obtain a Simple Moving Average, of the closing prices but only when the Stochastic is Oversold, and it does not give me any results.
For example, if the stock go oversold, and stay oversold for 8 bars, calculate the simple average of only those 8 bars. Thank you very much for any help you can give me.
TIMEFRAME (1DAY)
maximo = highest[14](high)
minimo = lowest[14](low)
oscilador = (close - minimo) / (maximo - minimo) * 100
REM Deducimos el %K y %D del estocástico
lineaK = average[6](oscilador)
lineaD = average[4](lineaK)
lineastochmin = 22
lineastochmax = 80
if (lineaK < lineastochmin) then
cta = 1 + cta[1]
else
cta = 0
endif
msstochsvta=Average[cta](close)
return msstochsvta as "msstoch", close as "close", cta as "cta"
JSParticipant
Senior
Hi @Lisandro77
if (lineaK < lineastochmin) then
cta = cta + 1
else
cta = 1
endif
JSParticipant
Senior
@Lisandro77
Screenshot of the indicator…
Thank you JS very much! It has been very useful to me..! Regards!