saico 59 posts msg #154034 - Ignore saico modified |
9/15/2020 2:52:24 PM
Hi everyone,
is there a way to change the code below, so that it will show stocks with a count of at least 4 days being in a squeeze?
Thanks for your help!
/* Keltner Bollinger Squeeze Filter Modified*/
set{xUp, days(upper bollinger(20,2.0) above the Upper Keltner Band(20,1.5) , 100 )}
set{xDn, days(lower bollinger(20,2.0) below the Lower Keltner Band(20,1.5) , 100 )}
set{xUBB, days(high >= upper bollinger(20,2.0) , 100 )}
set{xLBB, days(low <= lower bollinger(20,2.0) , 100 )}
set{xRange, high - low }
set{xRPCT, xRange / atr(20) }
set{xMomStudy, cema(momentum(12), 5) }
set{xReturn1, xMomStudy + MACD Fast Line(12,26) }
set{xReturn, xReturn1 / 2 }
/* plots */
draw xUp
draw xDn on plot xUp
draw xRange
draw atr(20) on plot xRange
draw momentum(12)
draw macd(12,26,9)
draw xReturn
draw xMomStudy
draw line 0 on plot xMomStudy
PlotType{xMomStudy,zerobar}
set{TTMSqueezeTop, count(Upper Bollinger Band(20,2) < Upper Keltner Band(20,1.5),1)}
set{TTMSqueezeBotA, count(Lower Bollinger Band(20,2) > Lower Keltner Band(20,1.5),1)}
set{TTMSqueezeBot, TTMSqueezeBotA * -1}
draw TTMSqueezeTop on plot xMomStudy
PlotType{TTMSqueezeTop,dot}
draw TTMSqueezeBot on plot xMomStudy
PlotType{TTMSqueezeBot,dot}
set{Kwidth, Upper Keltner Band(20,1.5) - Lower Keltner Band(20,1.5)}
set{Bwidth, Upper Bollinger Band(20,2) - Lower Bollinger Band(20,2)}
set{KBRatio, Bwidth / Kwidth}
add column KBRatio
/* column displays */
add column xUp
add column xDn
add column xUBB
add column xLBB
add column xRange
add column atr(20)
add column xRPCT
add column xReturn
/* squeeze selection */
upper bollinger(20,2.0) below the Upper Keltner Band(20,1.5)
lower bollinger(20,2.0) above the Lower Keltner Band(20,1.5)
xMomStudy above 0
price near upper bollinger(20,2)
/* price, volume selection */
close above 1
volume above 300000
|
nibor100 1,042 posts msg #154040 - Ignore nibor100 |
9/16/2020 1:23:46 PM
Sure there is, per pages 8 and 9 of the SF manual, add the phrase
"for the last 4 days"
to both of these lines:
upper bollinger(20,2.0) below the Upper Keltner Band(20,1.5)
lower bollinger(20,2.0) above the Lower Keltner Band(20,1.5)
Ed S.
|