Hold RSI value until next value

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #150118 quote
    Pierre Jansson Barradas
    Participant
    Average

    Hi all!

    Is it possible to some how hold a value depending on RSI (-1) until another RSI value is given and then change status to (1)?

    Example;

    IF RSI[14] > 70 then Short = -1 (i want it to hold -1 status until rsi drops under 30, then change to 1 and vise verse)

    IF RSI[14] < 30 then Long = 1

    Regards,

    Pierre

    #150124 quote
    snucke
    Participant
    Veteran

    IF RSI[14] > 70 then Short = -1

    IF RSI[14]  >30 AND RSI[14] <70 then neutral = 0

    IF RSI[14] < 30 then Long = 1

    Do something like this instead?

    #150221 quote
    Pierre Jansson Barradas
    Participant
    Average

    Almost but not there.

    I want it to hold -1 value as long as it doesnt get under RSI[14] < 30 and when it goes under 30 i want to hold the value 1 until it comes over RSI[14] > 70

    #150229 quote
    snucke
    Participant
    Veteran

    If close crosses over 70 then Short = -1

    if close crosses under 30 then Long = 1

     

    not tested, but i think this will hold the value until the next cross

    robertogozzi and Nicolas thanked this post
    #150364 quote
    Pierre Jansson Barradas
    Participant
    Average

    hum, no it doesn´t .. i have been trying to do if Short[1] is a specifik value then the next should be the same untill another value showes up..

    maybe this is more advanced then i first thougt.

    #150400 quote
    Vonasi
    Moderator
    Master

    Not sure I fully understand but perhaps something like this?

    if rsi[14] crosses over 70 then
    short = -1
    endif
    
    if rsi[14] crosses under 30 and short = -1 then
    short = 1
    endif
    
    if rsi[14] crosses under 30 then 
    long = 1
    endif
    
    if rsi[14] crosses over 70 and long = 1 then
    long = -1
    endif
    #150604 quote
    Pierre Jansson Barradas
    Participant
    Average

    Big Thanks! That didn´t come up in my my mind to reverse it that way, i made it much harder in my mind 😀

    and thanks @snucke for replying!

    #150625 quote
    Vonasi
    Moderator
    Master

    Glad you liked it however please don’t quote code in your replies unless it is totally necessary as part of your post. Also use the ‘quote’ button rather than cutting and pasting. I’ve tidied up your post.

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

Hold RSI value until next value


ProBuilder: Indicators & Custom Tools

New Reply
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/11/2020
Status: Active
Attachments: No files
Logo Logo
Loading...