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 |

PCF help Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
mjbaniewicz
Posted : Thursday, June 21, 2007 3:19:13 PM
Registered User
Joined: 1/15/2006
Posts: 19
Not sure if we'll be able to do this, but I want to put together a function that calculates something to referred to as the "stretch" (which is the 10-day moving average of the "tail" off the open price).

The formula is:

IF (O - L) < (H - O),
THEN (O - L)

IF (O - L) > (H - O),
THEN (H - O)

You then take the 10 day avergage of those values and that gives you the stretch. I have no clue how to program this and am not even sure if it can be done.

Thanks,
Mark
Bruce_L
Posted : Thursday, June 21, 2007 3:43:35 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
That would just seem to be the 10-Period Simple Moving Average of the smaller of O - L or H - O. If this is correct, please try the following:

(AVGH10 - AVGL10) / 2 - (ABS(2 * O - L - H) + ABS(2 * O1 - L1 - H1) + ABS(2 * O2 - L2 - H2) + ABS(2 * O3 - L3 - H3) + ABS(2 * O4 - L4 - H4) + ABS(2 * O5 - L5 - H5) + ABS(2 * O6 - L6 - H6) + ABS(2 * O7 - L7 - H7) + ABS(2 * O8 - L8 - H8) + ABS(2 * O9 - L9 - H9)) / 20

I'm actually suspecting from the verbal description (tail off the open price) that the mathematical description might be incorrect however and could possibly be something like the following instead:

IF C > O,
THEN O - L
ELSE IF O > C,
THEN H - O

I'm not sure if the upper or lower tail would be used if C = O if this is the case. A formula could be written for this as well (after the C = O case is defined).

You may wish to review the following:

Handy PCF example formulas to help you learn the syntax of PCFs!
How to create a Personal Criteria Forumula (PCF)

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
mjbaniewicz
Posted : Thursday, June 21, 2007 3:52:26 PM
Registered User
Joined: 1/15/2006
Posts: 19
Thank you! That works perfect.
Bruce_L
Posted : Thursday, June 21, 2007 3:56:48 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome. I'm happy to read it meets your needs.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
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.