Automatic drawing Standard Deviation Channel

Category: Indicators By: Louis Winthorp III Created: February 22, 2019, 1:29 PM
February 22, 2019, 1:29 PM
Indicators
5 Comments

This indicator plots automatically a linear regression channel with 1 and 2 standard deviation lines of the last X periods.

//Stand Dev Channel - indicator purpose : to automatically adjust every new tradingday (new candle)
DefParam DrawOnLastBarOnly = true

LinRegres = LinearRegression[LinRegPeriod](close)
LinRegresSlope = LinearRegressionSlope[LinRegPeriod](close)
StDev = STD[LinRegPeriod](close)

y1 = LinRegres - ((LinRegPeriod-1)*LinRegresSlope)

//RegressionLine
DRAWSEGMENT(barindex-(LinRegPeriod-1),y1,barindex,LinRegres)coloured(255,0,0)
//Stdev+1
DRAWSEGMENT(barindex-(LinRegPeriod-1),y1+StDev,barindex,LinRegres+StDev)coloured(255,128,0)
//Stdev-1
DRAWSEGMENT(barindex-(LinRegPeriod-1),y1-StDev,barindex,LinRegres-StDev)coloured(255,128,0)
//Stdev+2
DRAWSEGMENT(barindex-(LinRegPeriod-1),y1+(2*StDev),barindex,LinRegres+(2*StDev))coloured(51,102,0)
//Stdev-2
DRAWSEGMENT(barindex-(LinRegPeriod-1),y1-(2*StDev),barindex,LinRegres-(2*StDev))coloured(51,102,0)

Return

Download
Filename: StandDevChannelprobuilder.itf
Downloads: 302
Louis Winthorp III Average
This author is like an anonymous function, present but not directly identifiable. More details on this code architect as soon as they exit 'incognito' mode.
Author’s Profile

Comments

Logo Logo
Loading...