Hi, I am trying to make a screener for this indicator -https://www.prorealcode.com/prorealtime-indicators/standard-deviation-standard-error-linear-regression-channel/
A similar thread here gives some examples but i cant get any of them to work. https://www.prorealcode.com/topic/screener-help-for-nicolass-standard-deviation-error-lr-channel/
How could i go about screening for when the open price hits the lower band? Many Thanks
A screener detects and shows an event, while this indicator plots a channel.
To make a screener out of it you need to tell us what event do you want to be detected and shown. For example when a price touches or breaks one of the outer bands or the middle band or whatever else you want to be detected.
Hi Roberto, I wanted it so the screener screens when the open price hits the lower band.
test = high > linearregression[lookback]+std[lookback]*NbDeviation OR low < linearregression[lookback]-std[lookback]*NbDeviation
screener[test]
I’ve manged to get this one to work now. I think the other one the OP posted is not working.
This works:
//PRC_Std and Ste LinRegChannel | indicator
//Standard Deviation and Standard Error
//Linear Regression Channel
//12.03.2019
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
// --- settings
lookback= 200 //channel period
ChannelType = 1 //1= Standard Deviation ; 2= Standard Erro
NbDeviation = 1 //Deviation multiplier
// --- end of settings
sumx = 0
sumy = 0
sumxy = 0
sumx2 = 0
for cmpt = lookback downto 0 do
tmpx = cmpt
tmpy = close[cmpt]
sumy = sumy+tmpy
sumx = sumx+tmpx
sumx2 = sumx2 + (tmpx*tmpx)
sumxy = sumxy + (tmpy*tmpx)
next
n = lookback+1
if (sumx2 = sumx * sumx) then // protection to avoid infinite values
b = sumxy - sumx * sumy
else
b = (n * sumxy - sumx * sumy) / (n * sumx2 - sumx * sumx)
endif
a = (sumy - b * sumx) / n
//channel
if ChannelType = 1 then //Standard Deviation
dat = std[lookback]*NbDeviation
else
dat = ste[lookback]*NbDeviation
endif
//UPPER band
//UpperBand = a+b*0+dat
//drawsegment(barindex[lookback],(a+b*lookback)+dat,barindex,a+b*0+dat) coloured(colorRed,colorGreen,colorBlue)
//LOWER band
LowerBand = a+b*0-dat
//drawsegment(barindex[lookback],(a+b*lookback)-dat,barindex,a+b*0-dat) coloured(colorRed,colorGreen,colorBlue)
Cond = (open CROSSES UNDER LowerBand) OR (max(open,close) >= LowerBand AND min(open,close) <= LowerBand)
SCREENER[Cond]
Thanks Nicholas, it looks like this works also now. This will also help me looking into Kirshenbaum bands 🙂