Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 3/30/2011 Posts: 11
|
I'm looking to create a scan that detects a channel break of a prior downtrend. I'm using MAX(H2,15) to define the upper channel and I'm interested in only looking at stocks where MAX(H2,15) >= MAX(H1,15) over a certain number of days. In other words the upper 15 day channel high of any prior day can only be equal to or lower than the value 2 days before, but never higher. I'm now willing to accept one occurrence of the upper channel being lower than a subsequent day but I haven't yet found a way to set up a PCF where I can have either no occurrences or one occurence of a higher upper channel. I created a custom indicator that displays occurrences of a higher channel by using Sgn(MAX(H2,15) >= MAX(H1,15). This gives me a value of either -1 or 0 which I thought I might be able to translate into a number of occurrences over which (MAX(H2,15) >= MAX(H1,15) met my condition. I see that there are some restrictions in grouping operators for PCFs and so far I haven't found any syntax I can use to create my requirement. I would appreciate any suggestions you have.Also, since it appears that TC2000 ver.12 doesn't currently have a generic function to handle occurrences of a condition, I would like to submit a request that it be added to the platform in the future. I use another charting platform as well that has such a function and have found it extremely useful in building various scans. The decription of the function is "Occurrences (condition, the last n bars)". This will identify the number of True conditions that occurred for a specified criteria over a specified period.Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could use your original formula in a Custom PCF Percent True indicator. If you set the Period to the number of bars and the Average Type to Simple, it will give you the percentage of the time your Condition Formula was true over the number of bars specified in the Period.
You can then click on the Custom PCF True Indicator and select Create Condition to check for the value to be less than a desired percentage. You could also use the Condition in a Scan or Sort or even use the base Custom PCF True Indicator as a Sort.
Indicators, Sorting & Scanning
You could also manually construct a formula to count the number of instances. If you place a boolean (true or false) formula in parentheses, it will return -1 if true and 0 if false. If you place a boolean formula in an ABS() function, it will return 1 if true and 0 if false.
So lets say you wanted to make sure the count over 10-bars was less than or equal to 1. You could use the following formula:
ABS(MAXH15.2 >= MAXH15.1) - (MAXH15.3 >= MAXH15.2) - (MAXH15.4 >= MAXH15.3) - (MAXH15.5 >= MAXH15.4) - (MAXH15.6 >= MAXH15.5) - (MAXH15.7 >= MAXH15.6) - (MAXH15.8 >= MAXH15.7) - (MAXH15.9 >= MAXH15.8) - (MAXH15.10 >= MAXH15.9) - (MAXH15.11 >= MAXH15.10) <= 1
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/30/2011 Posts: 11
|
OK thanks. Is what you're describing above referring only to a custom indicator or can it also be created in a PCF? If the latter, can you give an example? If it can't be written in a PCF then the method that you describe of specifying every single day of a period to check against is a solution but not what I was looking for, especially when working with long periods. Hence my request for a type of occurrences function or some added grouping operator capabilities (e.g. MAX(Sgn(MAX(H2,10) >= MAX(H1,10),60)= -1). If there was a summing function that could be used over a specified period that could work too. As far as I know that isn't currently possible but correct me if I'm wrong.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (capa1) OK thanks. Is what you're describing above referring only to a custom indicator or can it also be created in a PCF?
I presented both solutions. The first method involved creating a Custom PCF % True Indicator:
"You could use your original formula in a Custom PCF Percent True indicator. If you set the Period to the number of bars and the Average Type to Simple, it will give you the percentage of the time your Condition Formula was true over the number of bars specified in the Period."
We can break that down:
- Select Add Indicator | Custom PCF % True Indicator.
- Set the Boolean Formula to your original formula: MAX(H2,15) >= MAX(H1,15)
- Set the Period to the number of bars over which you want to check.
- Set the Average Type to Simple.
The resulting Custom PCF % True Indicator will display the percentage of the time your formula was true over the Period. You can then click on the Custom PCF True Indicator and select Create Condition to check for the value to be less than a desired percentage. You could also use the Condition in a Scan or Sort or even use the base Custom PCF True Indicator as a Sort.
QUOTE (capa1) If the latter, can you give an example?
I did:
ABS(MAXH15.2 >= MAXH15.1) - (MAXH15.3 >= MAXH15.2) - (MAXH15.4 >= MAXH15.3) - (MAXH15.5 >= MAXH15.4) - (MAXH15.6 >= MAXH15.5) - (MAXH15.7 >= MAXH15.6) - (MAXH15.8 >= MAXH15.7) - (MAXH15.9 >= MAXH15.8) - (MAXH15.10 >= MAXH15.9) - (MAXH15.11 >= MAXH15.10) <= 1
QUOTE (capa1) If there was a summing function that could be used over a specified period that could work too.
Yes, but my suggestions work now.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/30/2011 Posts: 11
|
QUOTE (Bruce_L) [QUOTE=capa1]OK thanks. Is what you're describing above referring only to a custom indicator or can it also be created in a PCF? I presented both solutions.
OK, so then the answer to my question is you can't create a %True PCF as a filter (the indicator doesn't matter to me). That's the example I was looking for and by your reply the only way to do it is the long-hand method of writing the PCF to check each day.
Are there any plans to add the functions that I described to get around this long-hand method of checking a condition in the coming year?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (capa1) OK, so then the answer to my question is you can't create a %True PCF as a filter (the indicator doesn't matter to me).
If you have an indicator, you can create a Condition. All you have to do is click on it and select Create Condition. Since the result is a percentage and not a count, you will need to determine what percentage represents a count of one or less, but that is pretty straightforward.
Indicators, Sorting & Scanning
QUOTE (capa1) Are there any plans to add the functions that I described to get around this long-hand method of checking a condition in the coming year?
You just submitted your suggestion. There are literally thousands of suggestions in our database. I have no idea when or if your particular suggestion might be implemented.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/30/2011 Posts: 11
|
OK, now I see what you're describing. You're referring to creating a condition using the Custom PCF % True Indicator. That would work in situations where every element of a formula is OK to be checked against a single % True setting. But what I was looking for is a sytnax that can be written in a custom formula that performs the function of the PCF % True Indicator (without using the long-hand solution you gave earlier) on only one element of a custom formula.Thanks for your help. You've confirmed what I suspected.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you are willing to use a Scan, you can create multiple Conditions and include them in the same Scan. This would allow you to have multiple Conditions based on different length Custom PCF % True Indicators. One big limitation on this is that there isn't currently a way to OR the Conditions in a Scan. They are always combined with AND (so they all have to be true).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
capa1
I don’t know if this helps you, if you put a true/false condition in the ABS() function it equals 1 when true and 0 when false.
This allows you to add tests together and “count” how many times something has happened.
For example:
ABS(T1/F1)+ABS(T2/F2)+ABS(T3/F3)+ABS(T4/F4)>=2
will trigger if your true/false tests happened at least twice.
If your T/F conditions are for different days you can count (for example) that something happened twice in the last few days.
Thanks
diceman
|
|
Registered User Joined: 3/30/2011 Posts: 11
|
Hi diceman. Yes, thanks. This could work in some of the situations I'm lookingat and in others it won't. For the time being, it seems this is the best way to handle this. I'd love to see a Sum function and Occurrences function added to this platform in the future. It's really added flexibility to the scans I've been able to create in other platforms.
|
|
Guest-1 |