Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Moving Line Regression with ATR band Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
c_schmidt_2000
Posted : Thursday, April 25, 2013 3:42:51 PM
Registered User
Joined: 1/16/2012
Posts: 10

Hello,

I would like to build an indicator to chart based on a moving line regression 20 periods and a band of 1.5 and 2 times 20 period ATR around it. Is this possible? So its a kind of Keltner channel but based on a moving regression line instead of a moving average. 

thank you very much

Bruce_L
Posted : Thursday, April 25, 2013 4:07:58 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Try adding two Custom PCF Channel Indicators to the chart. You will want to use the following settings:

- Period: 1
- Average Type: Doesn't matter (because the period is 1).
- Indicator Line Formula: AVGC20 + 9.5 * (9.5 * C + 8.5 * C1 + 7.5 * C2 + 6.5 * C3 + 5.5 * C4 + 4.5 * C5 + 3.5 * C6 + 2.5 * C7 + 1.5 * C8 + 0.5 * C9 - 0.5 * C10 - 1.5 * C11 - 2.5 * C12 - 3.5 * C13 - 4.5 * C14 - 5.5 * C15 - 6.5 * C16 - 7.5 * C17 - 8.5 * C18 - 9.5 * C19) / 665
- Channel Width Formula: (AVGH20 - AVGL20) / 2 + (ABS(H - C1) + ABS(C1 - L) + ABS(H1 - C2) + ABS(C2 - L1) + ABS(H2 - C3) + ABS(C3 - L2) + ABS(H3 - C4) + ABS(C4 - L3) + ABS(H4 - C5) + ABS(C5 - L4) + ABS(H5 - C6) + ABS(C6 - L5) + ABS(H6 - C7) + ABS(C7 - L6) + ABS(H7 - C8) + ABS(C8 - L7) + ABS(H8 - C9) + ABS(C9 - L8) + ABS(H9 - C10) + ABS(C10 - L9) + ABS(H10 - C11) + ABS(C11 - L10) + ABS(H11 - C12) + ABS(C12 - L11) + ABS(H12 - C13) + ABS(C13 - L12) + ABS(H13 - C14) + ABS(C14 - L13) + ABS(H14 - C15) + ABS(C15 - L14) + ABS(H15 - C16) + ABS(C16 - L15) + ABS(H16 - C17) + ABS(C17 - L16) + ABS(H17 - C18) + ABS(C18 - L17) + ABS(H18 - C19) + ABS(C19 - L18) + ABS(H19 - C20) + ABS(C20 - L19)) / 40

You will set the Width Multiplier to 1.50 in one of the Custom PCF Channel Indicators and set the Width Multiplier to 2.00 in the other Custom PCF Channel Indicator. You will probably want to check Plot Center Line in at least one of teh Custom PCF Channel Indicators.

Note that the ATR used is a 20-Period Simple Moving Average of True Range which would match the ATR as plotted in TC2000 version 12.3. There are other possibilities however.

20-Day Average True Range
Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
c_schmidt_2000
Posted : Thursday, April 25, 2013 4:50:55 PM
Registered User
Joined: 1/16/2012
Posts: 10

Thank you Bruce, but the Indicator Line Formular seems not to be correct. Using it I get some strange results that doesnt match up with the build in 20 period moving line regression. 

Bruce_L
Posted : Thursday, April 25, 2013 4:53:32 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

The Indicator Line formula lines up perfectly with a 20-Period Moving Linear Regression.

Normally I would ask if you are plotting the formula using the same scale as Price History, but that should not be a problem if you are using a Custom PCF Channel Indicator as it is automatically scaled with Price History.

Are you sure the Period of your Moving Linear Regression is set to 20?



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
c_schmidt_2000
Posted : Thursday, April 25, 2013 5:12:39 PM
Registered User
Joined: 1/16/2012
Posts: 10

yes. using the daily SPY for instance. the 20 day moving line regression is 157.11. Using the "test formular" button in custom channel's indicator line formular I get a value of 202.42 

Bruce_L
Posted : Thursday, April 25, 2013 5:17:06 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Are you sure you have copied and pasted the Indicator Line Formula exactly as posted without adding anything extra or leaving anything out?

AVGC20 + 9.5 * (9.5 * C + 8.5 * C1 + 7.5 * C2 + 6.5 * C3 + 5.5 * C4 + 4.5 * C5 + 3.5 * C6 + 2.5 * C7 + 1.5 * C8 + 0.5 * C9 - 0.5 * C10 - 1.5 * C11 - 2.5 * C12 - 3.5 * C13 - 4.5 * C14 - 5.5 * C15 - 6.5 * C16 - 7.5 * C17 - 8.5 * C18 - 9.5 * C19) / 665

When I select Test Formula for the Indicator Line Formula on a Daily Chart for SPY I get a value of 157.11, which is exactly the same as what is being plotted by a 20-Period Moving Linear Regression.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
c_schmidt_2000
Posted : Thursday, April 25, 2013 5:26:54 PM
Registered User
Joined: 1/16/2012
Posts: 10

I found out... its the decimal format.... I had to change "." to "," in the formular cause my computer has german number format.  sorry for that. thank you very much. now eveything works fine. 

Bruce_L
Posted : Thursday, April 25, 2013 5:29:42 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome. I am happy to read you were able to figure out the issue.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.