number of bars

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

    Hi all again

    Attached a RSI/Price divergence with added Bolly Bands criteria indicator for your perusal. First of all could someone double check the code for me as my knowledge is somewhat limited and secondly I wish to limit the number of bars used to build the divergence, possibly only the last 20 bars? Hope that makes sense.

    #238014

    Ever tried using:

    from https://www.prorealcode.com/documentation/divergencersi/ ?

     

    2 users thanked author for this post.
    #238016

    Hi Robert

    In the indicator you post is 5 the number of RSI periods ?

    and the figure 20 I assume is the number of bars for the formation of a divergence, however, does that mean any divergence has to be formed on exactly 20 bars or any number of bars up to 20 ?

    many thanks for your help.

    #238021

    Divergence is calculated between the HIGHEST and the LOWEST prices within the last 20 bars (the bars in between can be as little as 2 and up to 20).
    You can read all detail at https://www.prorealcode.com/documentation/divergencersi/

     

    1 user thanked author for this post.
    #238023

    Again many thanks Robert

    If I could trouble you for one more thing. What code would include the added requirement for a close above or below the bolly bands at the time of the RSI divergence signal delivery..

    #238037

    Hi!
    Just add this:

    2 users thanked author for this post.
    #238106

    Good afternoon Ivan

    For some reason that isn’t having the desired affect. The original code is this………….

    i = DivergenceRSI[14,30,70,5](close)

    return i style(histogram)

    But I wish to add extra criteria that being a close > BB for a bearish divergence……..

    1
    cond=close>BollingerUp[20](close)

    and a close < BB for a bullish divergence……..

    1
    cond=close<BollingerUp[20](close)

     

    Hoping I’m making some kind of sense and really appreciative of your help.

     

    #238213

    There you go:

     

    1 user thanked author for this post.
    #238245

    Hi Robert

    Yes sir you are indeed correct, it should have been BollingerDown. Many thanks to yourself and all of the coding experts which help those of us who need it.

    1 user thanked author for this post.
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