Bollinger Band Squeeze with RSI Divergence
Forums › ProRealTime English forum › ProScreener support › Bollinger Band Squeeze with RSI Divergence
- This topic has 3 replies, 2 voices, and was last updated 7 years ago by Nicolas.
-
-
03/12/2017 at 7:09 PM #28333
Hi
I am looking for some assistance on creating a high ‘A quality’ setup for proscreener to do the following Bollinger Band squeeze with RSI divergence trades.
See the video here after the 6 minute marker, which explains the trading strategy. https://www.youtube.com/watch?v=7PY4XxQWVfM&list=TLUTNeV0_uFOc
I have created some code (far from perfect) to detect the boll squeeze and a trigger bar outside the upper bollinger (see below), but need RSI divergence detected which is inline with the relevant candles for the swing pivot ighs. So for example, when price makes a higher high, and RSI makes a lower high, go short.
I have looked at the platform RSI divergence indicators and also the RSX indicator Nicholas created here (https://www.prorealcode.com/prorealtime-indicators/divergences-rsx/),, but the coding is beyond my knowledge.
Anyone up for a challenge.
Thanks
Rob
12345678910111213141516171819202122232425// This detects before a potential breakout or breakdown with RSI divergence// Bollinger band squeeze increases the quality of breakout trade// Go Long// stocks higher than $10c1 = close > 10// average volume higher than 10kc2 = volume > 10000// identify upward trend price above 20MAc3 = average[20](close[2]) > average[20](close[12])// recent average bollinger bandwidth must be squeezedrecentboll = average[10](bollingerbandwidth[20](close[2]))pastbollbandwidth = average[20](bollingerbandwidth[20](close[2])) - recentbollc4 = (recentboll < pastbollbandwidth)// over sold trigger bar moving outside upper bollinger bandc5 = high[3] > BollingerUp[20][3]c6 = open[3] < BollingerUp[20][3]screener [c1 and c2 and c3 and c4 and c5 and c6 ]2 users thanked author for this post.
03/13/2017 at 11:09 AM #28377Interesting strategy because it has sense. The problem here is that you need 3 conditions that could not appear all at the same time:
- piercing of the bollinger bands
- a BB squeeze
- an RSI divergence
So to give an effective signal that compile all of these informations, we must define first a “lookback window” for these conditions to be true within these periods.
How much bars in the past from the current candlestick do you want to go back in the past to find if these conditions were fulfilled?
03/13/2017 at 11:29 AM #28380Hi Nicolas,
Thanks for your fast response.
For daily timeframe, the bollinger band squeeze would need to be decreasing over say, 12-15 bars. Within this band, would need to see the 2 swing highs with the higher high. And inline with the 2 highs of the candles that are touching or piercing the upper bollinger, to compare the RSI values at this point. The 2nd candle to pierce the upper bollinger and see a quick rejection would be preferable, but not absolutely necessary, so an OR maybe good here.
Entry would be on price action and a close of a bar closing lower than the previous 2-3 bars or even a doji.
This could be used on the 4 hourly and 1 hourly time frame. May need to configure the look back periods for the boll band squeeze.
Many thanks
Rob
03/13/2017 at 3:27 PM #28411This is the code for a complete screener that catch these conditions, from my own view. Only the bearish trades opportunity is coded. You need to test it by yourself! I modified the squeeze condition with a Bollinger Bands contained into a keltner channel instead.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960// stocks higher than $10c1 = close > 10// average volume higher than 10kc2 = volume > 10000// identify upward trend price above 20MAc3 = average[20](close[2]) > average[20](close[12])// recent average bollinger bandwidth must be squeezedUpperKC = average [20](close) + 1.5*averagetruerange[20](close)LowerKC = average [20](close) - 1.5*averagetruerange[20](close)c4 = summation[3](BollingerUp[20](close) < UpperKC and bollingerdown[20](close) > LowerKC)=3// over sold trigger bar moving outside upper bollinger bandc5 = summation[3](high crosses over bollingerup[20])>0//RSI divergences screener//--- parametersperiod = 14 //RSI periodoverbought = 70 //overbought RSI level//-------------------myRSI = RSI[period]y=average[2](myRSI)// ----if intradaybarindex=0 thenres=0endifif myRSI>overbought thenhi=max(hi,myRSI)hico=max(hico,max(high,high[1]))endifif myRSI crosses under y thenrsi2b=rsi1brsi1b=hihi=0p3b=p1bp2b=max(p1b,hico1)p1b=max(highest[3](high),hico)if p2b=p1b thenp2b=max(p3b,p4b)endifhico=0hico1=0endifif myRSI<y thenp4b=hico1hico1=max(hico1,high)endifdivBaissiere= p1b>p2b and rsi1b<rsi2b and myRSI crosses under y and myRSI<myRSI[1]if divBaissiere thenres=1endifc6 = summation[12](res)>0screener [c1 and c2 and c3 and c4 and c5 and c6] -
AuthorPosts
Find exclusive trading pro-tools on