Registered User Joined: 9/25/2005 Posts: 49
|
How would I write a pcf that would select a range of logrithmetic % only, i.e., I only want to see stocks above 3% and below, say, 6%?
No problem in the old TC version but the landscape has changed.
tu,
Cliff
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Assuming this request is the same as that made in your Wednesday, September 07, 2011 1:27:50 PM ET post in the Need help with writing a PCF topic, it still can't be done.
The zoom and gridlines in TC2000 version 12.1 are far more customizable than in TC2000 version 7. The zoom can be any number of bars. The number of gridlines can be set to a fixed number or left to automatically adjust on their own. We aren't going to roll back this customization so we can get a specific Personal Criteria Formula to match a number which describes the gridlines and not the stock itself (you can get this number displayed by using the % scale in TC2000 version 12.1).
The reason the formulas in my Tuesday, June 20, 2006 12:21:00 PM ET post in the Chart Scale Increment topic work is because they rely on TC2000 version 7 having exactly eleven gridlines and the Zooms being limited to one of eleven zooms (with exactly 20, 29, 44, 66, 99, 148, 222, 333, 500, 750 or 1125 bars). Even then, you need to have a different formula for each zoom.
The number returned is designed to do one thing. It is designed to match the percentage listed below the scale when the chart is set to Logarithmic.
The number which is displayed here just displays the percent difference between gridlines. It is designed to give you information about the chart, not information about the stock.
That said, the number is comparable between symbols and the comparisons are meaningful. The fact that the formulas are designed to match the number on the chart makes the results less meaningful than they could be however.
The red value displayed in the lower right hand corner of the logarithmic charts in TC2000 version 7 is specifically the percent difference between just the top two gridlines. And the values of the top two gridlines are rounded off to two digits past the decimal before the calculations are done. That's why the formulas are so long. For Zoom 9, this sort of formula looks like:
100 * ((100 * MAXH20 / ((MAXH20 / MINL20) ^ (1 / 12))) \ 1) / ((100 * MAXH20 / ((MAXH20 / MINL20) ^ (1 / 6))) \ 1) - 100
Now look at the formulas in my Monday, June 19, 2006 10:03:38 PM ET post in the Chart Scale Increment topic. They are shorter and produce similar but not identical values. For Zoom 9, this sort of formula looks like:
100 * (MAXH20 / MINL20) ^ (1 / 12) - 100
These formulas are better than the longer formulas for comparing symbols even though they don't match the number printed on the chart. They are better because the only reason the long formulas are so long is because they are using rounded values covering only one twelfth of the chart. The shorter formulas use the entire chart and don't round the values off before the calculation.
It is possible to get an even better comparison with greater graduation and differentiation between symbols by increasing the magnitude of the results. You can do this ignoring the pretense of trying to match the number in the lower right hand corner of the chart at all. You don't try to return the percent difference between gridlines, you try to return the percent difference over the entire chart. For Zoom 9, this sort of formula looks like:
100 * (MAXH20 / MINL20 - 1)
It doesn't match the number in the lower right hand corner of the chart, but it is better at comparing symbols by far than that number. It doesn't have rounding and it has a greater magnitude while making the same comparison.
I guess the issue is why you are using the formula and why you find it useful.
If you are just interested in volatility comparisons between symbols over some period of time, there is no need for the formula at all. There are better alternatives which make the same comparison.
If you aren't interested in such comparisons and just want a formula which matches the number on the charts for some reason, there isn't a way to do it. The Personal Criteria Formula Language would need to have a way to access the number of bars being displayed, the scroll in bars from the current bar and the number of gridlines being displayed to do the calculations.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 9/25/2005 Posts: 49
|
Thanks Bruce, really appreciate the time you took in your reply.
Got it and thank you,
Cliff
|