number of bars
Forums › ProRealTime English forum › ProBuilder support › number of bars
- This topic has 8 replies, 3 voices, and was last updated 2 months ago by LivJoJade.
-
-
09/25/2024 at 3:35 PM #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.
09/25/2024 at 5:03 PM #238014Ever tried using:
1myDIV = DivergenceRSI[5,30,70,20](close)from https://www.prorealcode.com/documentation/divergencersi/ ?
09/25/2024 at 6:02 PM #238016Hi 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.
09/25/2024 at 6:59 PM #238021Divergence 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.
09/25/2024 at 7:12 PM #23802309/26/2024 at 8:25 AM #238037Hi!
Just add this:1cond=close>BollingerUp[20](close)2 users thanked author for this post.
09/26/2024 at 7:54 PM #238106Good 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……..
1cond=close>BollingerUp[20](close)and a close < BB for a bullish divergence……..
1cond=close<BollingerUp[20](close)Hoping I’m making some kind of sense and really appreciative of your help.
09/28/2024 at 5:17 PM #238213There you go:
123456789101112i = DivergenceRSI[14,30,70,5](close)Signal = 0IF i = 1 THENIF close<BollingerUp[20](close) THEN //isn't it BollingerDown?Signal = 1ENDIFELSIF i = -1 THENIF close>BollingerUp[20](close) THENSignal = -1ENDIFENDIFreturn Signal style(histogram)1 user thanked author for this post.
09/29/2024 at 4:44 PM #238245Hi 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.
-
AuthorPosts
Find exclusive trading pro-tools on