Bollinger ATR Squeeze
Forums › ProRealTime English forum › ProBuilder support › Bollinger ATR Squeeze
- This topic has 6 replies, 2 voices, and was last updated 1 year ago by Alfy.
-
-
02/15/2023 at 12:18 PM #209738
Good afternoon, ive created this indicator that shows when the Bollinger bands divided by Average true range are trading within 3-4 ATR, 2-3 ATR and below 2 ATR. Im looking to have dots all on the zero level with white dots when the bollingers are between 3-4 ATR, Green dots between 2-3 ATR and blue dots below 2 ATR and red dots at all other times. Can someone take a look at my code and see where its going wrong please? Im seeing the dots in a squeeze at the one level whilst the rest of the dots are at the zero level and the dots at the zero level are white and red whereas they should just be red since at those times the Bollingers are wider than 4 ATR. Any help much appreciated.
Thanks in advance
Bollinger ATR Squeeze12345678910111213141516171819202122232425262728293031323334353637383940a=Average[20](Close)// We define the standard deviation.StdDeviation = STD[20](Close)Bsup = a + 2 * StdDeviationBinf = a - 2 * StdDeviationB=AVERAGETRUERANGE [20] (CLOSE)C=(BSUP-BINF)/BLowsqz=c=<4 and c>3midsqz=c=<3 and c>2highsqz=c=<2If lowsqz thenAcolorR = 255AcolorG = 255AcolorB= 255elsecolorR = 255colorG = 0COLORB=0endifIf midsqz thenBcolorR = 0BcolorG = 255BcolorB= 0elsecolorR = 255colorG = 0COLORB=0ENDIFIf highsqz thenCcolorR = 0CcolorG = 0CcolorB= 255elsecolorR = 255colorG = 0COLORB=0ENDIFReturn MIDSQZ coloured (BCOLORR,BCOLORG,BCOLORB) as "mid sqz", HIGHSQZ coloured (COLORR,COLORG,COLORB) as "high sqz", LOWSQZ coloured (ACOLORR,ACOLORG,ACOLORB) as "LOW SQZ"02/15/2023 at 12:56 PM #209741Hi Alfy,
Try this one…
Bollinger ATR Squeeze123456789101112131415161718192021222324252627282930313233343536373839404142434445a=Average[20](Close)// We define the standard deviation.StdDeviation = STD[20](Close)Bsup = a + 2 * StdDeviationBinf = a - 2 * StdDeviationB=AVERAGETRUERANGE [20] (CLOSE)C=(BSUP-BINF)/BLowsqz=c=<4 and c>3midsqz=c=<3 and c>2highsqz=c=<2If lowsqz thenDrawPoint(BarIndex,0,3)Coloured(255,255,255)//AcolorR = 255//AcolorG = 255//AcolorB= 255elseDrawPoint(BarIndex,0,3)Coloured(255,0,0)//colorR = 255//colorG = 0//COLORB=0endifIf midsqz thenDrawPoint(BarIndex,0,3)Coloured(0,255,0)//BcolorR = 0//BcolorG = 255//BcolorB= 0elseDrawPoint(BarIndex,0,3)Coloured(255,0,0)//colorR = 255//colorG = 0//COLORB=0ENDIFIf highsqz thenDrawPoint(BarIndex,0,3)Coloured(0,0,255)//CcolorR = 0//CcolorG = 0//CcolorB= 255elseDrawPoint(BarIndex,0,3)Coloured(255,0,0)//colorR = 255//colorG = 0//COLORB=0ENDIFReturn //02/15/2023 at 12:59 PM #209743Wow1 thanks for your help. It seems that only the mid squeeze is working..i have the green dots working fine but the rest of the dots are red which seems to suggest the white (wider sqz) and the blue (narrower sqz) are not being picked up.
02/15/2023 at 1:14 PM #20974502/15/2023 at 1:17 PM #209747I get the same as you so i see the green dots and the Blue dots but it seems that its not picking up the white dot wider squeeze which is C with values between 3 & 4. (Lowsqz=c=<4 and c>3) Really appreciate you help with this. Its almost perfect
02/15/2023 at 1:34 PM #209749Hi Alfy,
Try this one…
bb art squeeze1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950a=Average[20](Close)// We define the standard deviation.StdDeviation = STD[20](Close)Bsup = a + 2 * StdDeviationBinf = a - 2 * StdDeviationB=AVERAGETRUERANGE [20] (CLOSE)C=(BSUP-BINF)/BLowsqz=c=<4 and c>3midsqz=c=<3 and c>2highsqz=c=<2If lowsqz thenDrawPoint(BarIndex,0,3)Coloured(255,255,255)//AcolorR = 255//AcolorG = 255//AcolorB= 255else//DrawPoint(BarIndex,0,3)Coloured(255,0,0)//colorR = 255//colorG = 0//COLORB=0endifIf midsqz thenDrawPoint(BarIndex,0,3)Coloured(0,255,0)//BcolorR = 0//BcolorG = 255//BcolorB= 0else//DrawPoint(BarIndex,0,3)Coloured(255,0,0)//colorR = 255//colorG = 0//COLORB=0ENDIFIf highsqz thenDrawPoint(BarIndex,0,3)Coloured(0,0,255)//CcolorR = 0//CcolorG = 0//CcolorB= 255else//DrawPoint(BarIndex,0,3)Coloured(255,0,0)//colorR = 255//colorG = 0//COLORB=0ENDIFIf C > 4 thenDrawPoint(BarIndex,0,3)Coloured("Red")EndIfReturn //MIDSQZ coloured (BCOLORR,BCOLORG,BCOLORB) as "mid sqz", HIGHSQZ coloured (COLORR,COLORG,COLORB) as "high sqz", LOWSQZ coloured (ACOLORR,ACOLORG,ACOLORB) as "LOW SQZ"1 user thanked author for this post.
02/15/2023 at 1:39 PM #209753 -
AuthorPosts
Find exclusive trading pro-tools on