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 |

How do you use IF Then Else style functions when writting your own custom indicators Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
jayman54
Posted : Wednesday, January 25, 2006 1:10:57 PM
Registered User
Joined: 10/16/2005
Posts: 2
Doug_H
Posted : Wednesday, January 25, 2006 1:13:38 PM


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!
Craig_S
Posted : Wednesday, January 25, 2006 1:33:02 PM


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!
bustermu
Posted : Wednesday, January 25, 2006 2:55:04 PM
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
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.