Rsi, Rsi divergences and Bollinger Bands
Forums › ProRealTime English forum › ProBuilder support › Rsi, Rsi divergences and Bollinger Bands
- This topic has 16 replies, 3 voices, and was last updated 3 years ago by supertiti.
Tagged: bands, BB, Bollinger, Divergence, divergences, RSI
-
-
09/30/2021 at 10:47 AM #178778
In reply to this question https://www.prorealcode.com/topic/risk-and-money-management-errors/page/2/#post-178768, this is my reply.
Make the last line read:1Return rsi_14 AS "Rsi",70 AS "OverBought",30 AS "OverSold"10/02/2021 at 6:23 AM #178928Many thanks for the solution.
Now lets say a typical instrument presenting both ranging and trending market conditions over some periods. I want to add RSI crossover indicator signals and RSI divergence indicator signals to Bollinger bands such that whatever market conditions currently being presented the appropriate or corresponding signal will trigger.
May i know how feasible this strategy can be?
Regards.
10/02/2021 at 6:43 AM #178934Start new topics for different questions.
Thanks 🙂
I did it.
I’ll make it asap.
10/02/2021 at 9:21 AM #178936Please i don’t understand your previous message, does it mean you have already created a different topic for this? If so where is it, how can i access it?
May i know whether you also mean you will be able to help me in writing this strategy?
10/03/2021 at 5:38 PM #17897610/03/2021 at 6:26 PM #178977I already replied.
10/04/2021 at 2:08 AM #178985Do not double post. Ask your question only once and only in one forum. All double posts will be deleted anyway so posting the same question multiple times will just be wasting your own time and will not get you an answer any quicker. Double posting just creates confusion in the forums.
Thank you 🙂
I ALREADY replied you and did it (it wasn’t the same topic as before, couldn’t you see that?), as I already told you.
Be patient, I will do it as soon as possible (that’s what asap means).
10/05/2021 at 6:09 AM #179043There you go. This indicator will return:
- 1 = bullish signal
- -1 = bearish signal
You will set settings as best suits you.
I suggest that you set the properties so that the signal is plotted as a histogram.
123456789101112131415161718192021222324252627282930313233// BB-Rsi-Rsi Divergences//// settings//ONCE RsiP = 14 //14 RSI periods//ONCE RsiOB = 70 //70 - 30 (Overbought & Oversold)//ONCE DivLB = 40 //40 lookback periods for divergences//ONCE BB = 20 //20 Bollinger Bands periodsONCE RsiP = max(1,min(999,RsiP))ONCE RsiOB = max(0,min(100,RsiOB))ONCE DivLB = max(1,min(999,DivLB))ONCE RsiOS = 100 - RsiOB// RSI divergencesMyDivergence = DivergenceRSI[RsiP,RsiOS,RsiOB,DivLB](close)L1 = (MyDivergence = 1) //bullish divergenceS1 = (MyDivergence = -1) //bearish divergence// RSI crossoversMyRSI = Rsi[14](close)L2 = MyRsi CROSSES OVER RsiOS //bullish crossoverS2 = MyRsi CROSSES UNDER RsiOB //bearish crossover// BB (Bollinger Bands crossovers)L3 = close CROSSES OVER BollingerDOWN[BB]S3 = close CROSSES UNDER BollingerUP[BB]// combine Long & Short conditionsLcond = L1 AND L2 AND L3Scond = S1 AND S2 AND S3// return the correct triggering signalSignal = 0IF Lcond THENSignal = 1 //LONG SignalELSIF Scond THENSignal = -1 //SHORT SignalENDIFRETURN Signal AS "(Signal: 1=↑, -1=↓) ",0 AS "Zero"I also suggest that you import the attached ITF file where variables are already defined and declared. If you prefer to Copy & Paste the above code, uncomment lines 4-7.
10/06/2021 at 6:47 AM #179114Am so grateful for the codes.
After running according to your instruction i got the result in the attached screenshot.
Please can you help me interpret the result? am not familiar with the histogram presentation.
Also the signal symbols (arrows ) are not printed on the chart.
Also how are we able to confirm the RSI Crossover signals are confined to ranging conditions only?
Regards.
10/06/2021 at 6:49 AM #17911510/09/2021 at 11:26 AM #179252Open the indicator’s setting (xPic) and select HISTOGRAM (you can also change colours). I also sugget that you remove any color zone (yPic).
The indicator returns 1 for Long signals and -1 for short signals.
There is no provision for RSI crossovers. If you want to signal them just explain me what you want and, for ranging periods, how you want to detect them.
As for arrows, this is the version to be added ON your chart (not below like the other one) as from attached zPic:
123456789101112131415161718192021222324252627282930313233343536// BB-Rsi-Rsi Divergences//// settings//ONCE RsiP = 14 //14 RSI periods//ONCE RsiOB = 70 //70 - 30 (Overbought & Oversold)//ONCE DivLB = 40 //40 lookback periods for divergences//ONCE BB = 20 //20 Bollinger Bands periodsONCE RsiP = max(1,min(999,RsiP))ONCE RsiOB = max(0,min(100,RsiOB))ONCE DivLB = max(1,min(999,DivLB))ONCE RsiOS = 100 - RsiOBOffset = average[50,0](range) * 2// RSI divergencesMyDivergence = DivergenceRSI[RsiP,RsiOS,RsiOB,DivLB](close)L1 = (MyDivergence = 1) //bullish divergenceS1 = (MyDivergence = -1) //bearish divergence// RSI crossoversMyRSI = Rsi[14](close)L2 = MyRsi CROSSES OVER RsiOS //bullish crossoverS2 = MyRsi CROSSES UNDER RsiOB //bearish crossover// BB (Bollinger Bands crossovers)L3 = close CROSSES OVER BollingerDOWN[BB]S3 = close CROSSES UNDER BollingerUP[BB]// combine Long & Short conditionsLcond = L1 AND L2 AND L3Scond = S1 AND S2 AND S3// return the correct triggering signal//Signal = 0IF Lcond THEN//Signal = 1 //LONG SignalDrawArrowUP(BarIndex,low -Offset) coloured(0,128,0,150)ELSIF Scond THEN//Signal = -1 //SHORT SignalDrawArrowDOWN(BarIndex,high + Offset) coloured(255,0,0,255)ENDIFRETURN //Signal AS "(Signal: 1=↑, -1=↓) ",0 AS "Zero"11/03/2021 at 12:24 PM #18085711/03/2021 at 12:46 PM #180861BollingerUP and BollingerDOWN have a built-in 2.0 standard deviation that cannot be changed.
They need to be replaced by a custom BB calculation:12345BBp = 20 //20 BB periodsBBdev = 2.0 //2.0 BB deviationBBavg = average[BBp,0](close) //BB mean (middle line)BollUP = BBavg + ((std[BBp](close)) * BBdev) //BB Upper BandBollDN = BBavg - ((std[BBp](close)) * BBdev) //BB Lower Bandthen replace BolligerUP and BolligerDOWN with BollUP and BollDN, respectively.
11/03/2021 at 1:08 PM #18086211/03/2021 at 1:29 PM #180866BBRSI divergences123456789101112131415161718192021222324252627282930313233343536373839404142434445// BB-Rsi-Rsi Divergences Arrows by RobertoGozzi//// settings//ONCE RsiP = 14 perso =12 //14 RSI periods//ONCE RsiOB = 70 //70 - 30 (Overbought & Oversold)//ONCE DivLB = 40 perso = 30 //40 lookback periods for divergences//ONCE BB = 20 perso = 34 //20 Bollinger Bands periodsONCE RsiP = max(1,min(999,RsiP))ONCE RsiOB = max(0,min(100,RsiOB))ONCE DivLB = max(1,min(999,DivLB))ONCE RsiOS = 100 - RsiOBOffset = average[50,0](range) * 2// RSI divergencesMyDivergence = DivergenceRSI[RsiP,RsiOS,RsiOB,DivLB](close)L1 = (MyDivergence = 1) //bullish divergenceS1 = (MyDivergence = -1) //bearish divergence// RSI crossoversMyRSI = Rsi[12](close)L2 = MyRsi CROSSES OVER RsiOS //bullish crossoverS2 = MyRsi CROSSES UNDER RsiOB //bearish crossover///////////////////////////////////////////////////////////////////////////BBp = 20 //20 BB periodsBBdev = 2 //2.0 BB deviationBBavg = average[BBp,0](close) //BB mean (middle line)BollUP = BBavg + ((std[BBp](close)) * BBdev) //BB Upper BandBollDN = BBavg - ((std[BBp](close)) * BBdev) //BB Lower Band//then replace BolligerUP and BolligerDOWN with BollUP and BollDN, respectively.// BB (Bollinger Bands crossovers)L3 = close CROSSES OVER BollDN [BBp] //BollingerDOWN[BB]S3 = close CROSSES UNDER BollUP [BBp] //BollingerUP[BB]//////////////////////////////////////////////////////////////////////////// combine Long & Short conditionsLcond = L1 AND L2 AND L3Scond = S1 AND S2 AND S3// return the correct triggering signal//Signal = 0IF Lcond THEN//Signal = 1 //LONG SignalDrawArrowUP(BarIndex,low -Offset) coloured(0,128,0,150)ELSIF Scond THEN//Signal = -1 //SHORT SignalDrawArrowDOWN(BarIndex,high + Offset) coloured(255,0,0,255)ENDIFRETURN //Signal AS "(Signal: 1=↑, -1=↓) ",0 AS "Zero"Is this code is right ? because my signal on “banco de sabadell” on October 6th with the same parameters is missing ?
-
AuthorPosts
Find exclusive trading pro-tools on