TTM Squeeze Pro
Forums › ProRealTime English forum › ProBuilder support › TTM Squeeze Pro
- This topic has 4 replies, 4 voices, and was last updated 5 months ago by robertogozzi.
-
-
02/14/2023 at 10:24 AM #209650
Good morning guys, I’m trying to create the TTM Squeeze pro. The code already exists on site for the basic TTM squeeze which is when the Bollinger 20 day bands with 2 standard deviations around a 20d SMA move inside the 20d Keltner channels with 1.5 average true ranges (14d) around a 20d SMA. What I’ve tried to create is the squeeze pro which has 3 levels of compression. The lowest compression is when the Bollinger bands move inside the Keltner channels with 2 ATRs around the 20d SMA, the mid squeeze is when the Bollinger’s move inside the 1.5 ATR Keltner channels and finally the high compression squeeze is when the Bollinger’s move inside the Keltner’s with 1 ATR around the 20d SMA. I’ve tried to colour the dots white for the low compression sqz, Green for the mid compression and Blue for the high compression squeeze but the dots aren’t coming out coloured correctly. The rest looks ok. Can someone take a look at the code to see where I’m going wrong? Any help most appreciated.
Best regards
TTM Squeeze Pro1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889DonchianMidline = (Highest[20](high)+Lowest[20](low)+Average[20](close) )/3sma=close-(DonchianMidline)Delta = linearregression[20](sma)basis = exponentialaverage[length](close)dev = mult * Std[length](close)upperBB = basis + devlowerBB = basis - dev//KCma = exponentialaverage[lengthkc](close)myrange = averagetruerange[14]upperKClow = ma+myrange * 2lowerKClow = ma-myrange * 2upperKCmid = ma+myrange * 1.5lowerKCmid = ma-myrange * 1.5upperKChigh = ma+myrange * 1lowerKChigh = ma-myrange * 1sqzOnlow = (lowerBB>lowerKClow) AND (upperBB<upperKClow) AND (LOWERBB<LOWERKCMID) AND (UPPERBB>UPPERKCMID)sqzOnmid = (lowerBB>lowerKCmid) AND (upperBB<upperKCmid) AND (LOWERBB<LOWERKCHIGH) AND (LOWERBB>UPPERKCHIGH)sqzOnhigh = (lowerBB>lowerKChigh) AND (upperBB<upperKChigh)if(sqzOnlow=1) thenscolorR = 255scolorG = 255scolorB= 255elsescolorR = 255scolorG = 0ENDIFif(sqzOnmid=1) thenscolorR = 0scolorG = 255scolorB= 0elsescolorR = 255scolorG = 0ENDIFif(sqzOnhigh=1) thenscolorR = 0scolorG = 0scolorB=255elsescolorR = 255scolorG = 0ENDIFif delta>0 thensqz=-squeezeDotsOffset*pointsizeelsesqz=squeezeDotsOffset*pointsizeendif//histogram modificationsif delta>0 and delta>delta[1] thenplusI = deltaplusD = 0minusI = 0minusD = 0colorR=0colorG=245colorB=255elsif delta>0 and delta<delta[1] thenplusI = 0plusD = deltaminusI = 0minusD = 0colorR=0colorG=0colorB=255elsif delta<0 and delta<delta[1] thenplusI = 0plusD = 0minusI = 0minusD = deltacolorR=255colorG=0colorB=0elsif delta<0 and delta>delta[1] thenplusI = 0plusD = 0minusI = deltaminusD = 0colorR=255colorG=255colorB=0endifRETURN plusI coloured(colorR,colorG,colorB) style(histogram,1) as "plus increase", plusD coloured(colorR,colorG,colorB) style(histogram,1) as "plus decrease", minusI coloured(colorR,colorG,colorB) style(histogram,1) as "minus increase", minusD coloured(colorR,colorG,colorB) style(histogram,1) as "minus decrease", sqz coloured(scolorR,scolorG,0) style(point,5) as "squeeze momentum"02/14/2023 at 11:52 AM #209659Hi,
Line 19 doesn’t feel right, you could try replacing the lowerbb towards the end of the line with upperbb:
sqzOnmid = (lowerBB>lowerKCmid) AND (upperBB<upperKCmid) AND (LOWERBB<LOWERKCHIGH) AND (UPPERBB>UPPERKCHIGH)
1 user thanked author for this post.
02/14/2023 at 11:59 AM #20966005/26/2024 at 6:11 PM #233066BonjourQuand je télécharge le screener j’ai un message d’erreur ” Veuillez définir la variable suivante : length, lengthkc, mult, squeezeDotsOffset “Merci pour votre retourHello When I download the screener I get an error message “Please define the following variable: length, lengthkc, mult, squeezeDotsOffset” Thank you for your feedback
05/27/2024 at 1:11 PM #233089@ar
Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums. Thanks 🙂
-
AuthorPosts
Find exclusive trading pro-tools on