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.
Ever tried using:
myDIV = DivergenceRSI[5,30,70,20](close)
from https://www.prorealcode.com/documentation/divergencersi/ ?
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.
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/
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..
Hi!
Just add this:
cond=close>BollingerUp[20](close)
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……..
|
|
cond=close>BollingerUp[20](close)
|
and a close < BB for a bullish divergence……..
|
|
cond=close<BollingerUp[20](close)
|
Hoping I’m making some kind of sense and really appreciative of your help.
There you go:
i = DivergenceRSI[14,30,70,5](close)
Signal = 0
IF i = 1 THEN
IF close<BollingerUp[20](close) THEN //isn't it BollingerDown?
Signal = 1
ENDIF
ELSIF i = -1 THEN
IF close>BollingerUp[20](close) THEN
Signal = -1
ENDIF
ENDIF
return Signal style(histogram)
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.