Registered User Joined: 4/19/2012 Posts: 11
|
Is it possible to use a custom PCF I've created and saved (in My Indicators) in another custom PCF? I have named the custom indicator with no blanks or special characters (thinking maybe that was confusing the PCF editor) but can't seem to get the program to recognize it.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
There is no syntax available in the Personal Criteria Formula Language for referencing another PCF. You would generally need to include all of the calculations of the PCF you wish to reference in order to utilize its value in another PCF.
PCF Formula Descriptions
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 4/19/2012 Posts: 11
|
Thanks, Bruce. I was afraid of that. But perhaps there is another way to accomplish my objective.
What I want to do is calculate and plot an average of a variable when a certain condition is met. For instance, say the average price of a stock when its TSV is greater than 0. (Not the exact thing that I am trying to do, but it demonstrates the principles that I think are involved.) [I’ve been working with PCFs for only a short time, so please be gracious if my logic and skills are not quite up to snuff yet! ;-D]
As far as I can determine, I need to create two custom PCF cumulative indicators that would look something like this:
CountTSVgt0 = Formula( TSV > 0 , H < L , 1 )
and
CumPriceIfTSVgt0 = Formula( TSV > 0 , H < L , (H + L ) / 2 )
Then, a third custom PCF (not cumulative) indicator that would be:
CumPriceIfTSVgt0 / CountTSVgt0
I thought by creating the first two as specific ”My Indicators” I could reference them directly in a third PCF. According to your answer to my initial question, this is not possible -- so I would have to include the calculations of a cumulative PCF in a non-cumulative PCF - can this be done? Or is there another way to do this? TIA!
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You can do this as a Personal Criteria Formula using a fixed number of bars, but not as a cumulative indicator from the beginning of the plot. Let's say we did this over 5 bars. We would get the following for the count:
ABS(TSV > 0) - (TSV1.1 > 0) - (TSV1.2 > 0) - (TSV1.3 > 0) - (TSV1.4 > 0)
And the following for the sum over 5 bars:
(ABS(TSV > 0) * (H + L) - (TSV1.1 > 0) * (H1 + L1) - (TSV1.2 > 0) * (H2 + L2) - (TSV1.3 > 0) * (H3 + L3) - (TSV1.4 > 0) * (H4 + L4)) / 2
With the following as the average:
(ABS(TSV > 0) * (H + L) - (TSV1.1 > 0) * (H1 + L1) - (TSV1.2 > 0) * (H2 + L2) - (TSV1.3 > 0) * (H3 + L3) - (TSV1.4 > 0) * (H4 + L4)) / 2 / (ABS(TSV > 0) - (TSV1.1 > 0) - (TSV1.2 > 0) - (TSV1.3 > 0) - (TSV1.4 > 0) + .0000001)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|