Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/16/2005 Posts: 2
|
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 4,308
|
PCF/Custom Indicator language in TeleChart does not have IF/THEN/ELSE capabilities. What is it you are trying to accomplish? Perhaps there is some functionality that is available that will get you where you want to go.
- Doug Teaching Online!
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
there is a way to "fake it"
For example:
ABS(C>C1)*V + (C<=C1)*V
This will return a positive number for today's volume if the close as greater than the close yesterday and a negative number for today's volum if the close is less than or equal to yesterdays close.
When you include a Boolean statement in an equation it will return 0 (zero) if the Boolean is false, -1 if it is true.
the ABS() gives the absolute value.
- Craig Here to Help!
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
Suppose P is a True/False valued PCF and f and g are numerical valued PCFs.
The algorithm:
If P then x = f Else x = g End if x
returns the same value as the PCF:
(1+P)*g-P*f
In this sense, the PCF Language does have If/Then/Else, it is just spelled a little differently. To put it another way, there is nothing that can be accomplished with the PCF Language augmented by If/Then/Else that cannot be accomplished without such augmentation.
As an added note, the above can be accomplished without the use of the undocumented numerical evaluation of a Boolean PCF. It can all be accomplished with the use of the documented SGN function, but it can be much more difficult to do so.
Thanks, Jim Murphy
|
|
Guest-1 |