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 |

15-day DTA playing off of Landry's Pivot Points Topic Rating:
Previous Topic · Next Topic Watch this topic · Print this topic ·
gsn
Posted : Monday, March 14, 2005 6:59:59 PM
Registered User
Joined: 11/13/2004
Posts: 121
On (removed by Moderator), there's a PCF that indicates how often a stock will move up at least $1.00 above its opening price, the Bull DTA at (removed by Moderator):

DTA Bull PCF (15 day)
(((H>O+1AND(1))+
(H1>O1+1AND(1))+
(H2>O2+1AND(1))+
(H3>O3+1AND(1))+
(H4>O4+1AND(1))+
(H5>O5+1AND(1))+
(H6>O6+1AND(1))+
(H7>O7+1AND(1))+
(H8>O8+1AND(1))+
(H9>O9 +1AND(1))+
(H10>O10+1AND(1))+
(H11>O11+1AND(1))+
(H12>O12+1AND(1))+
(H13>O13+1AND(1))+
(H14>O14+1AND(1)))/15)*100



I am trying to write a similar PCF that indicates how often a stock will move up at least 50 cents from Landry's Pivot Point -- from the TC2000 yahoo group's files section:

PCF Name: #1 Pivot Point
((H+L+C)/3)

I think I get tripped up on parenthesis and PCFs. Here's what I've written. How am I doing?

(((H > ((H + L + C) / 3) + .50 AND (1)) + (H1 > ((H1 + L1 + C1) / 3) + .50 AND (1)) + (H2 > ((H2 + L2 + C2) / 3) + .50 AND (1)) + (H3 > ((H3 + L3 + C3) / 3) + .50 AND (1)) + (H4 > ((H4 + L4 + C4) / 3) + .50 AND (1)) + (H5 > ((H5 + L5 + C5) / 3) + .50 AND (1)) + (H6 > ((H6 + L6 + C6) / 3) + .50 AND (1)) + (H7 > ((H7 + L7 + C7) / 3) + .50 AND (1)) + (H8 > ((H8 + L8 + C8) / 3) + .50 AND (1)) + (H9 > ((H9 + L9 + C9) / 3) + .50 AND (1)) + (H10 > ((H10 + L10 + C10) / 3) + .50 AND (1)) + (H11 > ((H11 + L11 + C11) / 3) + .50 AND (1)) + (H12 > ((H12 + L12 + C12) / 3) + .50 AND (1)) + (H13 > ((H13 + L13 + C13) / 3) + .50 AND (1)) + (H14 > ((H14 + L14 + C14) / 3) + .50 AND (1))) / 15) * 100

To backtest, I wrote another PP.1 pcf that reports the pivot from yesterday: ((H1 + L1 + C1) / 3). I then compare it with how things went today. I'm getting some stocks that supposedly have a 100% rating over 15 days that did not go up 50 cents today, so something's amiss here...

Any help appreciated.
Bruce_L
Posted : Tuesday, March 15, 2005 9:33:43 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I'm not sure I completely understand your backtest, but you've indicated you are comparing how things went today with the pivot point for yesterday. On the other hand, the formula you gave always compares the high for a day (including today) to the pivot point for the same day (not the day before). Here is one way to write a formula comparing the high for the day with the pivot point of the previous day over the last fifteen days:

((H > (H1 + L1 + C1) / 3 + .5) * ( - 20) + (H1 > (H2 + L2 + C2) / 3 + .5) * ( - 20) + (H2 > (H3 + L3 + C3) / 3 + .5) * ( - 20) + (H3 > (H4 + L4 + C4) / 3 + .5) * ( - 20) + (H4 > (H5 + L5 + C5) / 3 + .5) * ( - 20) + (H5 > (H6 + L6 + C6) / 3 + .5) * ( - 20) + (H6 > (H7 + L7 + C7) / 3 + .5) * ( - 20) + (H7 > (H8 + L8 + C8) / 3 + .5) * ( - 20) + (H8 > (H9 + L9 + C9) / 3 + .5) * ( - 20) + (H9 > (H10 + L10 + C10) / 3 + .5) * ( - 20) + (H10 > (H11 + L11 + C11) / 3 + .5) * ( - 20) + (H11 > (H12 + L12 + C12) / 3 + .5) * ( - 20) + (H12 > (H13 + L13 + C13) / 3 + .5) * ( - 20) + (H13 > (H14 + L14 + C14) / 3 + .5) * ( - 20) + (H14 > (H15 + L15 + C15) / 3 + .5) * ( - 20)) / 3

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
gsn
Posted : Tuesday, March 15, 2005 12:23:10 PM
Registered User
Joined: 11/13/2004
Posts: 121
Thank you for your help. I'm sorry for not being clear enough. I want to use today's pivot point -- arrived at from end-of-day H, L and C from today -- on trading the next day.

Just to see how I would have done today for backtesting only had I used the pivot point from yesterday's end-of-day H,L,C, I did a pcf for yesterday's pivot to examine today's stock behavior at the end of today. (I could have written it down yesterday but figured this would be easier.)

Did my PCF look correct for indicating how often a stock will move up at least 50 cents from today's end of day Pivot Point?

It seems you are placing parens differently:

me: (((H > ((H + L + C) / 3) + .50 AND (1))
you: ((H>(H1+L1+C1)/3+.5)*(-20)

Should I alter mine to be:

((H>(H+L+C)/3+.5))AND (1)?

so that there would be no need for my additional paren at the beginning and end? Is that impacting the tabulation or is it just superfluous?

More importantly, I do not understand your use of '*(-20)' as opposed to 'AND (1)' in the pcf I worked with. I understand that AND (1) would add to the counter. I do not understand what multiplying by -20 does.

Thank you for your quick and very helpful response.
bustermu
Posted : Tuesday, March 15, 2005 1:06:57 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
Bruce and qsn,

The numerical evaluation of AND and OR was changed in TC2K about midway in the life of TC2K Version 5.3. Be careful about using such old PCFs.

Thanks,
Jim Murphy
Bruce_L
Posted : Tuesday, March 15, 2005 4:39:02 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
gsn,
No, don’t change the parenthesis in your formula to match mine. I avoided the use of AND in my formula, in part for the reason bustermu mentioned. This produces a different form with different parenthesis requirements. Your formula works (although it goes from zero to negative one hundred), I just decided to multiply the Boolean expression by a negative number to force a positive numeric result if True instead of using AND. Here is your original formula written using my form (with –1, 15 and 100 instead of –20 and 3 to make the form somewhat more parallel to your own).

((H > (H + L + C) / 3 + .5) * ( - 1) + (H1 > (H1 + L1 + C1) / 3 + .5) * ( - 1) + (H2 > (H2 + L2 + C2) / 3 + .5) * ( - 1) + (H3 > (H3 + L3 + C3) / 3 + .5) * ( - 1) + (H4 > (H4 + L4 + C4) / 3 + .5) * ( - 1) + (H5 > (H5 + L5 + C5) / 3 + .5) * ( - 1) + (H6 > (H6 + L6 + C6) / 3 + .5) * ( - 1) + (H7 > (H7 + L7 + C7) / 3 + .5) * ( - 1) + (H8 > (H8 + L8 + C8) / 3 + .5) * ( - 1) + (H9 > (H9 + L9 + C9) / 3 + .5) * ( - 1) + (H10 > (H10 + L10 + C10) / 3 + .5) * ( - 1) + (H11 > (H11 + L11 + C11) / 3 + .5) * ( - 1) + (H12 > (H12 + L12 + C12) / 3 + .5) * ( - 1) + (H13 > (H13 + L13 + C13) / 3 + .5) * ( - 1) + (H14 > (H14 + L14 + C14) / 3 + .5) * ( - 1)) / 15 * 100

Here is why I think I have to be misunderstanding your test. This formula compares the high for today with the pivot point for today over fifteen days. Let’s say the result of this formula is 100%. You then run a backtest comparing the high for today with the pivot point for yesterday. A stock with a high that is not .50 higher than the pivot point for yesterday does not contradict the 100% formula result and does not necessarily indicate anything amiss with the formula.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
gsn
Posted : Thursday, March 17, 2005 3:01:43 PM
Registered User
Joined: 11/13/2004
Posts: 121
Thank you so much for your help. I still don't understand what Jim said about "the numerical evaluation of AND and OR was changed in TC2K about midway in the life of TC2K Version 5.3. Be careful about using such old PCFs." Where is this stuff written up in the TC2005 help files? I would like to read up more on how to do PCFs and be aware of such changes, etc.
Doug_H
Posted : Thursday, March 17, 2005 3:31:59 PM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
I'm not sure that issue is documented anywhere. If it is, perhaps someone could chime in as to where to find it.

- Doug
Teaching Online!
Bruce_L
Posted : Thursday, March 17, 2005 3:45:29 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
To the best of my knowledge, the use of logical operators in formulas that are not strictly Boolean is not in the manual or help files, is not supported, and is subject to change in how it works or even if it works. It should probably be noted that anything that can be done using these operators can also be done entirely with supported functions like SGN() and ABS(), but the resulting formulas are usually longer.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bustermu
Posted : Friday, March 18, 2005 7:58:19 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
QUOTE (Doug_H)
I'm not sure that issue is documented anywhere. If it is, perhaps someone could chime in as to where to find it.


Since we cannot direct you to other sites, I will copy the messages pretaining to "Numerical Evaluation of Logic Statements" here. The appostrophes are used to stop icons from appearing. Please ignor them when reading and remove them when writing PCFs

1) Before the change:

The greatest shortcomming of the TC2K language is the lack of
conditionals and loops. If they were present, you may lose a lot of
less mathematically inclined users. The use of the numerical
evaluation of logic statements makes them unneccessary.
Unfortunatly, there is extensive misuse of this concept,
particularly at the ... site. We will document some uses of
the numerical evaluation of logic statements.

First. let us consider a simple example. The PCF:

(C>C1)*(-1) - (C<C1)*(-1)

will test True or False, but takes on the values 1 if C>C1, 0 if
C=C1, and -1 if C<C1 when used to Sort or when embedded in another
PCF. The reason being that the numerical evaluation of a truth-
valued statement is -1 if True and 0 if False. For those familuar
with programming, this PCF is equivalent to:

N=0
If C>C1 then
N=1
End if
If C<C1 then
N=-1
End if

The N takes on the same value as the above PCF.

Let P and Q be truth-valued PCF's and let x and y be numerically-
valued PCF's. We will consider only PCF's of the forn:

1) ('P')*('x')
2) ('P')AND('x')
3) (-1)AND('x')

We will need a particular definition of rounding a real number. If
b is a real number, define rnd('b') to be the closest integer to b and
a tie goes to the even integer. With this definition, we have the
numerical evaluations:

1) ('P')*('x') = -x, if P = True
,,,('P')*('x') = 0, if P = False
2) ('P')AND('x') = rnd('x'), if P = True
,,,('P')AND('x') = 0, if P = False
3) (-1)AND('x') = rnd('x')

These results should enable you to determine for yourself which
PCF's using the numerical evaluation of logical statements are
sensible.

The PCF's of the forms 1), 2), and 3) are probably the only ones
employing the numerical evaluation of logic statements of use to
the general user. The forms ('x')AND('y') and ('x')OR('y') introduce an
interesting algebraic structure on the integers. I have some
interesting theorems on the subject. Since ('x')OR('y') has been used
in a PCF, I will give one:

Theorem: If rnd('x')>=0 and rnd('y')>=0, then
max(rnd('x'),rnd('y')) <= ('x')OR('y') <= rnd('x')+rnd('y').

2) After the change:

It is time to re-visit this topic since the results previously
stated are not true for Version 5.3, Build 34. The consequence is
that PCF's using the numerical evaluation of logic statements using
AND or OR may no longer give the intended results.

> Let P and Q be truth-valued PCF's and let x and y be numerically-
> valued PCF's. We will consider only PCF's of the forn:
>
> 1) ('P')*('x')
> 2) ('P')AND('x')
> 3) (-1)AND('x')
>
> We will need a particular definition of rounding a real number.
If
> b is a real number, define rnd('b') to be the closest integer to b
and
> a tie goes to the even integer. With this definition, we have the
> numerical evaluations:
>
> 1) ('P')*('x') = -x, if P = True
> ,,,('P')*('x') = 0, if P = False
> 2) ('P')AND('x') = rnd('x'), if P = True
> ,,,('P')AND('x') = 0, if P = False
> 3) (-1)AND('x') = rnd('x')

For Version 5.3, Build 34, 1) is still true, but 2) and 3) are not.
For Version 5.3, Build 34:

2') ('P')AND('x') = -1, if P = True, x <> 0
....('P')AND('x') = 0, otherwise
3') (-1)AND('x') = -1, if x <> 0
....(-1)AND('x') = 0, x = 0

In my opinion (almost worthless), this is a great loss to the
academician but barely noticeable to the trader. The only place I
have seen AND or OR appropriately used in this fashion, where they
could not be replaced by something simpler, is in rounding a number.
Has anyone ever observed otherwise?

End copies.

It does not make sense to me that you cannot place a letter in parentheses without getting one of those icons.

Thanks,
Jim Murphy
bustermu
Posted : Friday, March 18, 2005 8:53:51 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
QUOTE (Bruce_L)
It should probably be noted that anything that can be done using these operators can also be done entirely with supported functions like SGN() and ABS(), but the resulting formulas are usually longer.


This was almost true even before the signum function was available by using the approximation:

SGN('x') ~ x/(ABS('x')+0.000001)

Before the change, I once responded to how to get the integer part of C with:

(-1)AND(C-0.4999)

which no longer works.


The best I now know is:

(C>=0)*(C<1)*0+(C>=1)*(C<2)*1+(C>=2)*(C<3)*2+...

and stop somewhere way up there.

Can you improve that?

Thanks,
Jim Murphy
Bruce_L
Posted : Tuesday, May 3, 2005 10:13:07 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
bustermu,
Not documented, but try this:

(C-.4999)\1

On a related note, MOD also seems to work. Try this:

C MOD 10

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ejr39
Posted : Tuesday, May 3, 2005 7:27:56 PM
Registered User
Joined: 1/28/2005
Posts: 125
qns;

> PCF that indicates how often a stock (HAS moved)
> up at least 50 cents from Landry's Pivot Point

Modified Bull DTA (Day Trader's Advantage)
PCF Name: #1 Pivot Point
((H+L+C)/3)

Using the Custom PerCent True setting
Middle or Bottom Window
. Percent True Settings
_ _ _ Draw Color:
_ _ _ Draw Style:
_ _ _ Check: Visible
_ _ _ Smoothing Average: 15 Simple
Boolean Formula
H>(((H+L+C)/3)+.50)

PCF Name: #1 Bull DTA(15) using Pivot Point
1-(((H>(((H+L+C)/3)+.50)AND(1))+
(H1>(((H1+L1+C1)/3)+.50)AND(1))+
(H2>(((H2+L2+C2)/3)+.50)AND(1))+
(H3>(((H3+L3+C3)/3)+.50)AND(1))+
(H4>(((H4+L4+C4)/3)+.50)AND(1))+
(H5>(((H5+L5+C5)/3)+.50)AND(1))+
(H6>(((H6+L6+C6)/3)+.50)AND(1))+
(H7>(((H7+L7+C7)/3)+.50)AND(1))+
(H8>(((H8+L8+C8)/3)+.50)AND(1))+
(H9>(((H9+L9+C9)/3)+.50)AND(1))+
(H10>(((H10+L10+C10)/3)+.50)AND(1))+
(H11>(((H11+L11+C11)/3)+.50)AND(1))+
(H12>(((H12+L12+C12)/3)+.50)AND(1))+
(H13>(((H13+L13+C13)/3)+.50)AND(1))+
(H14>(((H14+L14+C14)/3)+.50)AND(1)))/15)*100

ejr
bustermu
Posted : Wednesday, May 4, 2005 7:39:43 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
ejr,

Please notice that if you delete the "AND(1)" in each term, you obtain the identical result. Also, if you replace the "1" in front by "0", the resulting number might be more meaningful to most.

The PCF is not very useful since, for one thing, H > (H+L+C)/3+0.5 is True when H-L > 1.5 and False when H-L <= 0.75. My guess is that qsn was actually looking for Bruce's first PCF.

Thanks,
Jim Murphy
bustermu
Posted : Wednesday, May 4, 2005 8:39:56 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
QUOTE (Bruce_L)
bustermu,
Not documented, but try this:

(C-.4999)\1

On a related note, MOD also seems to work. Try this:

C MOD 10


Bruce,

Thanks. I did not know that interger divide (\) and modulo (MOD) worked.

Users beware! Let y be positive. From mathematics, most would believe that

x\y = k

and

xMODy = x-k*y

where k is the unique integer such that

k*y <= x < (k+1)*y.

This is not usually the case for programs and there is not agreement among programs.

Bruce, C MOD 10? You must like low priced stocks.

Thanks,
Jim Murphy
gsn
Posted : Monday, August 14, 2006 5:39:18 PM
Registered User
Joined: 11/13/2004
Posts: 121
Bruce, could I ever trouble you to help me write a PCF that will compute the number of times over the past 15 days that a stock has risen one percent from its open? (Similar to the 15-day DTA I listed in the original message of this thread.)
diceman
Posted : Monday, August 14, 2006 8:06:47 PM
Registered User
Joined: 1/28/2005
Posts: 6,049
qsn

Are you aware of the short-cut method of using a percent true indicator and
smoothing it with a simple moving average.

It wont give you a count you will get the percent true over the smoothing period.

The highest values will be the ones where it happened the most.

You could create:

H>=(O*1.01)

Smooth it with a 15 period simple moving average.
You can click on the indicator and use sort by actual value to
sort a watchlist.

The advantage of this method is you can change the 15 length just
by changing the moving average.

Thanks
diceman
Craig_S
Posted : Monday, August 14, 2006 10:31:33 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
This PCF should do it:

ABS((H>=O*1.01)+
(H1>=O1*1.01)+
(H2>=O2*1.01)+
(H3>=O3*1.01)+
(H4>=O4*1.01)+
(H5>=O5*1.01)+
(H6>=O6*1.01)+
(H7>=O7*1.01)+
(H8>=O8*1.01)+
(H9>=O9*1.01)+
(H10>=O10*1.01)+
(H11>=O11*1.01)+
(H12>=O12*1.01)+
(H13>=O13*1.01)+
(H14>=O14*1.01))

- Craig
Here to Help!
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.