MA & RSI indicator help needed

Forums ProRealTime English forum ProOrder support MA & RSI indicator help needed

  • This topic has 2 replies, 3 voices, and was last updated 2 days ago by avatardruby.
Viewing 3 posts - 1 through 3 (of 3 total)
  • #242464

    Hi

    Trying to wrap my head around procode:

    Buy:

    a. A cross over EMA 50 and SMA 20

    b. Previous RSI(14) value to be < 50

    c. Current RSI(14) value to be >= 50

    Buy condition (a AND b AND c)

    Draw arrow on chart

    –Code–

    //—–Current State——————————————–//
    TEMAx = Average[20,0](Close)
    FSMA = AVERAGE[50,1](Close)

    //—–Current State——————————————–//
    rsivalue=RSI[14](Close)

    BCond1 = TEMAx crosses over FSMA
    BCond2 = rsiValue <= 50
    BCond3 = rsiValue[1] >= 50
    BBuy = (BCond1 and BCond2 and BCond3)

    IF BBuy THEN
    DRAWARROWUP(barindex, low-2*pipsize) coloured(0,255,0)//Signal = low
    ENDIF

    RETURN

    I just get a blank chart – any tips please ?

     

    #242466

    Check Cond b and c in your code; [1] is the previous bar.

    But anyway over how many bars are you checking?

    Also maybe it is just that your 3 conditions are not coincident over the number of bars you are checking?

    Go for 2 conditions then add the 3rd condition when you can see UPARROWS etc.

    1 user thanked author for this post.
    #242468

    The chart panels have the ability to auto-scale the y-axis (price).

    When this happens the item(s)(variable’s) highest high and or lowest low are used to set the approximate visible y-scale range for the panel.

    Only certain drawing items invoke the auto y-scale, such as DRAWCANDLE(,,,), there maybe others but, I don’t think that DRAWARROWUP is one of them.

     

    As an example, the candles high’s and low’s are plotted, and the highest high and lowest low of all the visible candles displayed in the chart frame, sets the range .

    This is why a new candle that create a new visible higher high and/or lower low, adjust the y-scale range.

    This also can happen when the left most candle falls off screen and its was the visible highest high or lowest low.

     

    The reason for mentioning DRAWCANDLE is that the candles drawn in the PRICE panel appear to work the same way.

    Adding you code indicator to the price panel, would probably display the arrows, if nothing else wrong, since the arrows y position would be close to the low value of the candle.

    Unless, it just happens to be at the extreme of visible range.

    If creating a new panel, the scale range doesn’t have the price candles to set the range, which defaults around zero.

     

    Variables displayed, using   the RETURN line of an INDICATOR, also invoke the auto y-scale.

     

    In your code example, you use RETURN, making it INDICATOR code, also no variables are on the RETURN line to invoke the y-scale.

    If I’m right, DRAWARROWUP also does not invoke the auto y-scale, and if your creating a new panel, then I would expect a panel to be set around zero.

    You can drag the charts y scale to expose the value where the arrows should be, but the lack of auto scale can reset it back to zero.

     

    A simple test would be to add      LOW, HIGH      to the return line, this would invoke the auto scale around the HIGHER high and lower low and hopefully display the arrow, if in the visible scope of the chart.

    Saying ‘ I just get a blank chart’ I assume your creating a new chart panel.

     

    2 users thanked author for this post.
Viewing 3 posts - 1 through 3 (of 3 total)

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