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 |

PCF for calculating how well a price fits in/outside a fixed width channel Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
rwesley
Posted : Friday, April 28, 2006 4:36:41 PM
Registered User
Joined: 2/14/2006
Posts: 15
Hi,

I'm attempting to produce a PCF which will give a measure of how well the daily price spread of a stock fits in/outside a fixed width channel over a defined period.

I'm not that interested in the direction of any trend, whether it is bullish, bearish or even a horizontal channel, just the spread of the daily price bar in/outside the channel over the period, e.g. a reading of 0% would indicate that the spread of the daily price bars all fall within the channel, 50% indicates that only half the spread of the daily price bars lies within the channel either because some daily highs lie above the channel and/or some the daily lows lie below the channel. I do not want the percentage to reflect the number of days where price lies in/outside the channel, but the percentage of the price itself which lies in/outside the channel.

e.g. I want to generate a 30 day linear regression line based on the closing price bounded by a fixed width channel which could be anything e.g. +/- (AVGH30 - AVGL30)/2, +/- (H - L)/2, +/- C*0.1 etc etc.

I think I've got the PCF for generating the slope of the 30 day linear regression of closing price:

( 14.5*C + 13.5*C1 ... - 13.5*C28 - 14.5*C29) / coefficients^2

which means I can go back and generate the channel bounds on any of the past 30 days to see what amount of price was outside the channel, then divide the sum for each day by the sum of (high - close) for each day.

However I can't help thinking that I am completely overcomplicating the PCF or that a standard indicator already exists (maybe based on linear regression channels, standard deviation of price?) to generate something similar to what I am looking for.

Any advice gratefully received.

Best Regards
Richard
Bruce_L
Posted : Friday, April 28, 2006 4:47:47 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I don't know a way to find out what percentage of a price range was outside an arbitrary channel without explicitly calculating it in the manner you outlined.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
diceman
Posted : Friday, April 28, 2006 7:56:07 PM
Registered User
Joined: 1/28/2005
Posts: 6,049
rwesley

Quote:"However I can't help thinking that I am completely overcomplicating the PCF or that a standard indicator already exists (maybe based on linear regression channels, standard deviation of price?) to generate something similar to what I am looking for."

I think you have answered your own question.

I don't think for all the complications your indicator will offer any more than a liner regression
channel sort.
You can also sort by the percent slope of the line.

The only way I can think of to "count" things in a channel is with a percent true indicator.

Something like C<AVGC10*1.03ANDC>AVGC10*.97 this will trigger every time the close is inside
a +-3% band of a 10 day moving average. You can add from the indicator window a 50 day
moving average(simple) This will give you a percent over the last 50 bars of how often it was true.

Of course the "50", "10", and +-3% can all be adjusted by you.


Hope that helps
Good Luck


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.