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 |

Sorting on the date before current day Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
ccaipei
Posted : Sunday, February 11, 2007 12:13:38 PM
Registered User
Joined: 8/19/2006
Posts: 6
Can I do sorting on the doate other than today, or say the date several days ago?
Bruce_L
Posted : Sunday, February 11, 2007 12:19:03 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
There are two distinct ways to use historical data with Personal Criteria Formulas.

Any criteria can be used to scan X number of days back by adding '.XX' where XX is equal to the number of market days past to calculate for. An example of this is (AVGC21.21), which is a 21 day moving average 21 of close, 21 days ago. This use of historical data always refers to the market day XX number of days ago (in this case, 21). If you wish to use a specific date’s data, use the option detailed below.

The other method of using historical data is by specifying a precise date in history to use. For example, (AVGC21.'12/31/97') will provide a 21 day moving average of close for December 31, 1997 (the period should be used in cases where the first method requires a period and not used when the first method does not use a period). In this particular case, December 31 is the last trading day of that specific year. This will not always be the case. Always confirm that the date you wish to use using this parameter was a market day.

You may wish to review the following:

Create your own stock rankings using WatchLists and Sort conditions
How to create a Personal Criteria Forumula (PCF)
Handy PCF example formulas to help you learn the syntax of PCFs!

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ccaipei
Posted : Sunday, February 11, 2007 5:49:35 PM
Registered User
Joined: 8/19/2006
Posts: 6
Thanks for your quick reply.
But my concerns is how can I sort Linear Regression and Bollinger Bands on 11/12/06 as example.
Bruce_L
Posted : Monday, February 12, 2007 9:11:20 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You can't use indicator sorting to do this, but you can use Personal Criteria Formulas as described in my previous post in this topic. Here are some examples:

Slope of 6-Period Linear Regression for previous period:

AVGC6.1 + 2.5 * (2.5 * C1 + 1.5 * C2 + 0.5 * C3 - 0.5 * C4 - 1.5 * C5 - 2.5 * C6) / 17.5

Slope of 6-Period Linear Regression for 11/13/06 (I couldn't use 11/12/06 since it was not a trading day):

(2.5 * C'11/13/06' + 1.5 * C'11/10/06' + .5 * C'11/09/06' - .5 * C'11/08/06' - 1.5 * C'11/07/06' - 2.5 * C'11/06/06') / 17.5

Price > Upper Bollinger Band (6,15) for previous period:

C1 > AVGC6.1 + 1.5 * SQR(ABS(C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 - 6 * AVGC6.1 ^ 2) / 5)

Price > Upper Bollinger Band (6,15) for 11/13/06:

C'11/13/06' > AVGC6.'11/13/06' + 1.5 * SQR(ABS(C'11/13/06' ^ 2 + C'11/10/06' ^ 2 + C'11/09/06' ^ 2 + C'11/08/06' ^ 2 + C'11/07/06' ^ 2 + C'11/06/06' ^ 2 - 6 * AVGC6.'11/13/06' ^ 2) / 5)

You may wish to review the following:

Modelling Bollinger Bands (& Standard Deviation) in a TC PCF
Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis
Linear regression channel calculations

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ccaipei
Posted : Monday, February 12, 2007 12:17:04 PM
Registered User
Joined: 8/19/2006
Posts: 6
I set for Linear Regression and saw three straight line came up on the graphic. And then I do sorting I can get the result.
How can I set Linear Regression using PCF and see the same as I do using build in functio?
Please give me the procedure step by step.
Thanks,

Peter Cao
Bruce_L
Posted : Monday, February 12, 2007 1:16:26 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I've been thinking about using Indicator Sorting on past dates. You can create a Custom Indicator reproducing Price for any date, apply your Bollinger Band or Linear Regression to this and then use any of the built in Indicator Sorts. For example, to do this for Linear Regression ending on 11/13/06:

Select Chart Template | Add Indicator | Indicator:
- Visible: Checked or Unchecked? (doesn't really matter).
- Center Zero Line: Unchecked
- Plot using price scale: Unchecked
- Smoothing Average: 1
- Average Type: Doesn't matter (because the Smoothing Average is 1)
- Indicator Formula: C'11/13/06'
Select Chart Template | Add Indicator | Linear Regression | FormulaC'11/13/06' 1 Period
Adjust the settings as desired.
Do an Indicator Sort on this Linear Regression.

The Visual Slope will not match the Actual Value that would have happened on that date because the scaling will be based on the Highest Close and Lowest Close instead of the Highest High and Lowest Low during the period, but it should be fairly close under a significant percentage of the time. The Percent Slope Value should match what would have happened at the time.

If you really want to try this using Personal Criteria Formulas, you may wish to review the following:

PCF TO RANK MUTUAL FUNDS USING LINEAR REGRESSION LINE
Linear Regression Visual Sorts from "n" days ago.
PCFs for Sort By

-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.