Moving Average RSI Hybrid Line

Forums ProRealTime English forum ProBuilder support Moving Average RSI Hybrid Line

Viewing 9 posts - 1 through 9 (of 9 total)
  • #47126

    Good Day

    I only recently started playing around coding and more specifically graphing indicators.

    I am looking to create a simple indicator that works and functions exactly like a standard moving average line except the color of the line is dependent on the position of the RSI2 period.

    Variables should be as follows:

    RSI Period: i.e. 2
    Moving Average Period: i.e. 21
    Moving Average Type: i.e. 2 (Exponential)
    RSI Top Threshold: 90
    RSI Bottom Threshold: 10

    Thus as long as the RSI Period is within the threshold, the moving average line is black.
    If the RSI is above the threshold the line is red and if below blue.

    #47136

    I think it is only possible to have two different colours but not three.

    #47139

    Guess I would need two lines then right on top of each other, one changing color from black to blue if below the RSI threshold and another changing black to red if above the threshold.

     

    #47142

    You can do it with just your one line, just use an if statement to define the 3 variables r, g, b according to your various rsi thresholds so that each set of r,g,b defines each of the 3 colours you want, and then use them in the color definitions in your return line “return myma coloured (r,g,b)”

    1 user thanked author for this post.
    #47144

    Sthg like:

     

    #47148

    Excellent idea Noobywan. A little related problem I had 2 days ago. If i use drawhline  to draw a line and then I want it to disappear again. How can this be done? Just painting over with white doesn’t work since the background of PRT is not white. :-S

    #47152

    In the context of being able to keep some graphic objects drawn on previous bars while deleting some others, I haven’t found a way to selectively make lines disappear because of background as you said, however if keeping previous graphic elements doesn’t matter, then adding at the beginning of the code the line:

    will allow you to keep only the horizontal line you’ve defined on the last bar (and so it needs to be defined at each bar even if it doesn’t move), but it will delete anything else drawn on previous bars

    1 user thanked author for this post.
    #47161

    Here is the MARSI indicator you described @juanj.

    Edit: Now I see Noobywan posted the same already above.  .-)

    #47164

    Thanks, Guys, implemented it as follows:

     

     

Viewing 9 posts - 1 through 9 (of 9 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login