RSI and Stochastics Values

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #189741 quote
    Nassim
    Participant
    New

    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…

    #189744 quote
    JC_Bywan
    Moderator
    Master

    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
    #189764 quote
    Nicolas
    Keymaster
    Master

    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 🙂

    #196160 quote
    Lisandro77
    Participant
    Average

    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"
    Screenshot-2022-06-26_20-27-04.png Screenshot-2022-06-26_20-27-04.png
    #196162 quote
    JS
    Participant
    Senior

    Hi @Lisandro77

    if (lineaK < lineastochmin) then
    cta = cta + 1
    else
    cta = 1
    endif

    Lisandro77 and Nicolas thanked this post
    #196164 quote
    JS
    Participant
    Senior

    @Lisandro77

    Screenshot of the indicator…

    Lisandro77 thanked this post
    Schermafbeelding-2022-06-26-om-22.59.47.png Schermafbeelding-2022-06-26-om-22.59.47.png
    #196166 quote
    JS
    Participant
    Senior

    @Lisandro77

    Screenshot with “cta” …

    Lisandro77 thanked this post
    Schermafbeelding-2022-06-26-om-23.05.52.png Schermafbeelding-2022-06-26-om-23.05.52.png
    #196399 quote
    Lisandro77
    Participant
    Average

    Thank you JS very much! It has been very useful to me..! Regards!

    JS thanked this post
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

RSI and Stochastics Values


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Nassim @nassim Participant
Summary

This topic contains 7 replies,
has 5 voices, and was last updated by Lisandro77
3 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/10/2022
Status: Active
Attachments: 3 files
Logo Logo
Loading...