Squeeze Trading Indicator
Forums › ProRealTime English forum › ProBuilder support › Squeeze Trading Indicator
- This topic has 12 replies, 4 voices, and was last updated 4 years ago by Nicolas.
Tagged: squeeze
-
-
02/18/2020 at 4:38 PM #119856
Squeeze Trading Indicator
from https://www.netpicks.com/squeeze-out-the-chop/
The basic formulas we need are:
Bollinger Band = Moving Average + (Number of standard deviations X Standard Deviation)
Keltner Channel = Moving Average + (Number of ATR’s X ATR)Or if we translate this into pseudo-code:
12BBUpper = Avg(close,period) + (BBDevs X StdDev(close,period))KCUpper = Avg(close,period) + (KCDevs X ATR(period))The squeeze is calculated by taking the difference between these two values:
1Squeeze = BBUpper – KCUpperWhich simplifies down to this:
1Squeeze = (BBDevs X StdDev(close,period)) – (KCDevs X ATR(period))- Hello Nicholas sorry for the mix-up sending it to the wrong place hopefully there’s enough information i’ve linked the web page that it’s from and also sticking a picture I can make a basic version of this but it would not use the standard deviation or the ATR so I’d like to see this version with that in it and then test that out, thank you.
- Patrick
Moderators edit: Post edited to remove text from inserted code. Please only insert actual code when using the ‘Insert PRT Code’ button.
02/18/2020 at 5:20 PM #119861These screeners uses BB + KC to tell a squeeze: https://www.prorealcode.com/topic/bollinger-band-squeeze-with-rsi-divergence/#post-28411, https://www.prorealcode.com/prorealtime-market-screeners/intraday-volatility-explosion-screener/.
Did you ever happen to use the search box? It’s your friend, don’t be afraid.
02/18/2020 at 5:50 PM #119862Hello robertogozzi
Does the screener show up on the charts as an indicator because I’m doing a lot of backtesting and I use the simplified creation tool for backtesting so it helps a lot to have it on the chart thank you
Patrick
02/18/2020 at 6:12 PM #119864This is the one at https://www.prorealcode.com/prorealtime-market-screeners/intraday-volatility-explosion-screener/ (it returns explosions, you can set it as a histogram):
12345678910111213141516171819202122232425262728293031323334353637//********* Parameters *********//Keltner channeln=20coeff=1.5//Bollinger Bandsperiod=10deviation=1//Candles lookbackxCandles=4//******************************//keltner bandsMA = Average[N](TypicalPrice)UpperBand = MA + coeff*Average[N](Range)LowerBand = MA - coeff*Average[N](Range)//bollinger bandsBBmiddle = average[period](close)dev = std[period](close)BBup = BBmiddle+dev*deviationBBdown = BBmiddle-dev*deviationcount = 0for i = 1 to xCandles doc1 = BBup[i]<UpperBand[i]c2 = BBdown[i]>LowerBand[i]if c1 and c2 thencount = count+1endifnextvalidate = count=xCandlesbullishexplosion = BBup>UpperBandbearishexplosion = BBdown<LowerBandResult = 0IF validate AND bullishexplosion THENResult = 1ELSIF validate AND bearishexplosion THENResult = -1ENDIFRETURN Result02/18/2020 at 6:35 PM #119871That indicated that you shared me is only a breakout indicator can you change it into a zero line Cross please
I have only a very basic understanding of coding I’ve watched quite a few videos, if I Could code it myself I would, zero line cross indicator version might be more beneficial
Thank you
Patrick
02/18/2020 at 6:53 PM #119874What do you mean by zero line?
BB & KC do not have 0.
02/18/2020 at 7:06 PM #119875I might be able to use this line in a different way like putting a moving average on it so its a zero line Cross plus momentum then use it in conjunction with other indicators might have a winning strategy most likely not
02/18/2020 at 7:14 PM #119878Yes you’re right the Bollinger bands and keltner channels do not but the indicator based on them that I would like you to build would,
just to clarify rate of Change would be a zero line cross.
thank you
Patrick
02/18/2020 at 11:47 PM #119903Ok, I changed so that it returns all crossings with different colours:
- bullish explosion: plain GREEN (returns 1)
- bullish implosion: light GREEN (returns 1)
- bearish explosion: plain RED (returns -1)
- bearish implosion: ligtht RED (pink) (returns -1)
The attached pic shows all possible crossings of the Bollinger Bands over/under the Keltner Channel.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869//********* Parameters *********//Keltner channeln = 20coeff = 1.5//Bollinger Bandsperiod = 10deviation = 1//Candles lookback//xCandles = 4t = 255r = 0g = 128b = 0validate = 1//----------------------------------------------------//keltner bandsMA = Average[N](TypicalPrice)UpperBand = MA + coeff*Average[N](Range)LowerBand = MA - coeff*Average[N](Range)//----------------------------------------------------//bollinger bandsBBmiddle = average[period](close)dev = std[period](close)BBup = BBmiddle+dev*deviationBBdown = BBmiddle-dev*deviation//----------------------------------------------------// Explosion (expansion)//count = 0//for i = 1 to xCandles do//c1 = BBup[i]<UpperBand[i]//c2 = BBdown[i]>LowerBand[i]//if c1 and c2 then//count = count+1//endif//next//validate = count=xCandlesbullishexplosion = BBup crosses over UpperBandbearishexplosion = BBdown crosses under LowerBand//----------------------------------------------------// Implosion (contraction)//count = 0//for i = 1 to xCandles do//c1 = BBup[i]<UpperBand[i]//c2 = BBdown[i]>LowerBand[i]//if c1 and c2 then//count = count+1//endif//next//validate = count=xCandlesbullishimplosion = BBup Crosses under UpperBandbearishimplosion = BBdown crosses over LowerBand//----------------------------------------------------Result = 0IF validate THENIF bullishexplosion OR bullishimplosion THENResult = 1IF bullishimplosion THENt = 48ENDIFELSIF bearishexplosion OR bearishimplosion THENResult = -1r = 255g = 0IF bearishimplosion THENt = 48ENDIFENDIFENDIFRETURN Result coloured(r,g,b,t) AS "Result",0 AS "Zero"02/19/2020 at 1:55 AM #119910Roberto
you won’t believe this I don’t really believe this but I think I’ve done it even so I still would like to thank you for helping
It’s not 100% because it only incorporates the upper Bollinger band and the upper keltner channel which doesn’t give you 100% Reading somehow how I need to factor in in the lower band and the lower channel into the equation but I don’t know how to do that
Here’s what I have done
123456789REM Computes the daily variationsindicator1 = ExponentialAverage[20](close)+2*std[20](close)indicator2, ignored = CALL "Keltner Bands Indicator"[20, 1.7, 0](close)c1 = (indicator1 - indicator2)Squeeze Trading Indicator = c1return Squeeze Trading Indicator as "STi"02/19/2020 at 2:47 AM #119912The other one might be better
SqueezeTradingIndicator12345678910111213indicator1 = ExponentialAverage[20](close)+2*std[20](close)indicator2, ignored = CALL "Keltner Bands Indicator"[20, 1.7, 0](close)c1 = (indicator1 - indicator2)indicator3 = ExponentialAverage[20](close)-2*std[20](close)ignored, indicator4 = CALL "Keltner Bands Indicator"[20, 1.7, 0](close)c2 = (indicator3 - indicator4)SqueezeTradingIndicator = c1+c2/2return SqueezeTradingIndicator as "SqueezeTradingIndicator"0 as "0 level"Thank you again
Patrick
02/19/2020 at 7:55 AM #119916You don’t need to call the indicator twice so the code can be simplified a little further. Also you forgot a comma in your return line.
Please always use the ‘Insert PRT Code’ button when posting code. I tidied up your first code that you posted. 🙂
12345678910indicator1 = ExponentialAverage[20](close)+2*std[20](close)indicator3 = ExponentialAverage[20](close)-2*std[20](close)indicator2, indicator4 = CALL "Keltner Bands Indicator"[20, 1.7, 0](close)c1 = (indicator1 - indicator2)c2 = (indicator3 - indicator4)SqueezeTradingIndicator = c1+c2/2return SqueezeTradingIndicator as "SqueezeTradingIndicator",0 as "0 level"1 user thanked author for this post.
02/19/2020 at 10:58 AM #119930Various “squeeze” codes:
https://www.prorealcode.com/tag/squeeze/
https://www.prorealcode.com/topics-tag/squeeze/
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on