| Trading Indicators Post your custom trading indicators. If you download, remember to click INSTALL. |
![]() | | Tweet | |
Linear Regression Channel Details »» | |||||||||||||||||||||||||
I have no clue how to upload the indicator so I'll just post the coding. [LegacyColorValue = true]; {Updated by DJ Reda on Sat 4/16/05 Added option to use either Standard Deviation or Standard Error of Estimate to plotchannel bands} { // Note: Setting a begin date that is earlier than the amount of length for the regression will produce an extend to the left model that is date and time restricted The End Date must not be in the future // } inputs: STD1_SEE2(2), Length ( 50), { // Length of Linear Regression // } Size(1),//Trend Line Thickness BeginDate ( 0), { // Choose Zero to use full length // } BeginTime ( 0), { // Choose Zero to use full time // } EndDate ( 0), { // Choose Zero for Current Day // } EndTime ( 0), { // Choose Zero for Current Time // } NumDevsUp ( 2), { // Standard deviations for upper // } NumDevsDn ( -2), { // Standard deviations for lower // } LRColor ( Green), { // Color for Linear Regression Line // } STDDevColor( Magenta), { // Color for Upper Boundary // } SEEColor(Magenta) , { // Color for Lower Boundary // } ExtRight ( false), { // Set to true to extend to right // } ExtLeft ( false); { // Set to true to extend to left // } variables: FirstDate ( 0 ), FirstTime ( 0 ), UpperBand ( 0 ), LowerBand ( 0 ), UpperBand_1 ( 0 ), LowerBand_1 ( 0 ), LRV ( 0 ), LRV_1 ( 0 ), TL_LRV ( 0 ), TL_UB ( 0 ), TL_LB ( 0 ), Flag ( 0 ), SDev ( 0 ); if BeginDate = 0 then FirstDate = date[ Length - 1 ] else FirstDate = BeginDate; if BeginTime = 0 then FirstTime = time[ Length - 1 ] else FirstTime = BeginTime; { ///////////////////////////////////////////////////////////////////// } if Flag = 0 then begin if ( EndDate = CurrentDate or EndDate = 0 ) and LastBarOnChart then begin LRV = LinearRegValue( Close, Length, 0 ); LRV_1 = LinearRegValue( Close, Length, Length - 1 ); {++++++++New Code to Choose between plotting Std Dev or Std Error++++++} If STD1_SEE2 = 1 then SDev = StandardDev( Close, Length, 1 ); If STD1_SEE2 = 2 then begin //use Standard Error of Estimate Value1 = StdError(Close, Length); SDEV = Value1; end; {++++++++End New Code++++++} UpperBand = LRV + NumDevsUp * SDev; LowerBand = LRV + NumDevsDn * SDev; UpperBand_1 = LRV_1 + NumDevsUp * SDev; LowerBand_1 = LRV_1 + NumDevsDn * SDev; TL_LRV = TL_New( FirstDate, FirstTime, LRV_1, date, time, LRV ); TL_UB = TL_New( FirstDate, FirstTime, UpperBand_1, date, time, UpperBand ); TL_LB = TL_New( FirstDate, FirstTime, LowerBand_1, date, time, LowerBand ); Flag = 1 ; end else if date = EndDate and ( time = EndTime or EndTime = 0 ) then begin LRV = LinearRegValue( Close, Length, 0 ); LRV_1 = LinearRegValue( Close, Length, Length - 1 ); {++++++++New Code to Choose between plotting Std Dev or Std Error++++++} If STD1_SEE2 = 1 then SDev = StandardDev( Close, Length, 1 ); If STD1_SEE2 = 2 then begin //use Standard Error of Estimate Value1 = StdError(Close, Length); SDEV = Value1; end; {++++++++End New Code++++++} UpperBand = LRV + NumDevsUp * SDev; LowerBand = LRV + NumDevsDn * SDev; UpperBand_1 = LRV_1 + NumDevsUp * SDev; LowerBand_1 = LRV_1 + NumDevsDn * SDev; TL_LRV = TL_New( FirstDate, FirstTime, LRV_1, date, time, LRV ); TL_UB = TL_New( FirstDate, FirstTime, UpperBand_1, date, time, UpperBand ); TL_LB = TL_New( FirstDate, FirstTime, LowerBand_1, date, time, LowerBand ); Flag = 2; end; if Flag = 1 or Flag = 2 then begin TL_SetColor( TL_LRV, LRColor ); If STD1_SEE2 = 1 then begin TL_SetColor( TL_UB, STDDevColor ); TL_SetColor( TL_LB, STDDevColor ); end; If STD1_SEE2 = 2 then begin TL_SetColor( TL_UB, SEEColor ); TL_SetColor( TL_LB, SEEColor ); end; TL_SetSize(TL_LRV, size); TL_SetSize(TL_UB, size); TL_SetSize(TL_LB, size); TL_SetExtLeft( TL_LRV, ExtLeft ); TL_SetExtLeft( TL_UB, ExtLeft ); TL_SetExtLeft( TL_LB, ExtLeft ); TL_SetExtRight( TL_LRV, ExtRight ); TL_SetExtRight( TL_UB, ExtRight ); TL_SetExtRight( TL_LB, ExtRight ); end; end else if Flag = 1 then begin LRV = LinearRegValue( Close, Length, 0 ); LRV_1 = LinearRegValue( Close, Length, Length - 1 ); {++++++++New Code to Choose between plotting Std Dev or Std Error++++++} If STD1_SEE2 = 1 then SDev = StandardDev( Close, Length, 1 ); If STD1_SEE2 = 2 then begin //use Standard Error of Estimate Value1 = StdError(Close, Length); SDEV = Value1; end; {++++++++End New Code++++++} UpperBand = LRV + NumDevsUp * SDev; LowerBand = LRV + NumDevsDn * SDev; UpperBand_1 = LRV_1 + NumDevsUp * SDev; LowerBand_1 = LRV_1 + NumDevsDn * SDev; TL_SetBegin( TL_LRV, FirstDate, FirstTime, LRV_1 ); TL_SetBegin( TL_UB, FirstDate, FirstTime, UpperBand_1 ); TL_SetBegin( TL_LB, FirstDate, FirstTime, LowerBand_1 ); TL_SetEnd( TL_LRV, date, time, LRV ); TL_SetEnd( TL_UB, date, time, UpperBand ); TL_SetEnd( TL_LB, date, time, LowerBand ); end; { // Code modified from tradestation indicator of LinearRegLine by Greg Ballard, 04/09/2003 // } This indicator was sent to me from Pat B. from TTM LRC I'd attach some screen shots of how I use the LRC, but I have no clue what I'm doing. Screenshots Show Your Support
| |||||||||||||||||||||||||
| ∧ Similar Indicator | ||||
| Mod | Developer | Type | Replies | Last Post |
| XCAP IPolyFit | Tams | Trading Indicators | 3 | 11:14 AM 10-31-2009 |
| XCAP IPolyFitPredict | Tams | Trading Indicators | 3 | 06:12 AM 11-07-2009 |
| XCAP_iPolyCycle | Tams | Trading Indicators | 12 | 09:13 AM 03-04-2010 |
| Comments |
| | #10 | ||
![]() | Re: Linear Regression Channel | ||
| |
|
| | #11 | ||
![]() | Re: Linear Regression Channel I am not very good at all with paisting indicators in multicharts, can someone please tell me how to copy and past that code into multicharts or maybe post the indicator. Many thanks, | ||
| |
|
| | #12 | ||
![]() | Re: Linear Regression Channel Quote:
Open PowerEditor, select File > New enter indicator name, paste in code. click Compile | ||
| |
|
| | #13 | ||
![]() | Re: Linear Regression Channel Quote:
Done, and it works. Many thanks Sir. | ||
| |
|
| | #14 | ||
![]() | I am not very good at all with paisting indicators in multicharts, could someone please just post the indicator.( EazyLanguageDocumenFile) thank you very much | ||
| |
|
| | #15 | ||
![]() | Re: Linear Regression Channel Here it is | ||
| |
|
| The Following User Says Thank You to aaa For This Useful Post: | ||
Stat (03-12-2011) | ||
| | #16 | ||
![]() | Re: Linear Regression Channel
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #17 | ||
![]() | Re: Linear Regression Channel I am very bad at all with paisting indicators in multicharts, could someone please just post the indicator.( EazyLanguageDocumen File) thank you very much | ||
| |
|
![]() |
| Tags |
| regression |
| Thread Tools | |
| Help Others By Rating This Thread | |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 'Linear Regression Line' indicator in Tradestation | Dogpile | Coding Forum | 1 | 11-30-2007 01:01 PM |