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 |

R Squared/TSI Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
diceman
Posted : Tuesday, March 14, 2017 2:29:29 PM
Registered User
Joined: 1/28/2005
Posts: 6,049

Can the new language reduce the size of R Squared say a 21 period?

Does the new language allow a True Strength Index PCF say Short: 13 Long: 25?

 

While I know its a built in indicator. A PCF would allow you to mark the chart based on conditions.

 

 

 

Thanks

 

 

Bruce_L
Posted : Wednesday, March 15, 2017 11:04:28 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Yes, it is possible to shorten both formulas. A 21 period R-Squared can be written as follows.

(11 * (FAVGC21 - AVGC21) / SQR(110 * (AVG(C ^ 2, 21) - AVGC21 ^ 2) / 3)) ^ 2

And a TSI 13, 25 can be written as follows. 

XAVG(XAVG(C - C1, 13), 25) / XAVG(XAVG(ABS(C - C1), 13), 25)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
diceman
Posted : Wednesday, March 15, 2017 11:58:58 AM
Registered User
Joined: 1/28/2005
Posts: 6,049

QUOTE (Bruce_L)

Yes, it is possible to shorten both formulas. A 21 period R-Squared can be written as follows.

(11 * (FAVGC21 - AVGC21) / SQR(110 * (AVG(C ^ 2, 21) - AVGC21 ^ 2) / 3)) ^ 2

 

If you change the period (the 21s) do the 11 and 110 remain the same

or do they change with different period?

 

 

Thanks

 

Bruce_L
Posted : Wednesday, March 15, 2017 12:41:12 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

No, the actual template is in the R-Squared (R^2) topic referenced in the original response.

((x + 1) / 2 * (FAVG(w, x) - AVG(w, x)) / SQR((x ^ 2 - 1) * (AVG((w ) ^ 2, x) - AVG(w, x) ^ 2) / 12)) ^ 2

Where w can be any formula which returns a numeric value.
Where x is the period.


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
donv98
Posted : Thursday, March 23, 2017 11:17:17 AM
Registered User
Joined: 7/29/2010
Posts: 417

Bruce,

   Would the below pcf from V 17 be possible using the old  formulas?

 

XAVG(XAVG(C - C1,3), 8) / XAVG(XAVG(ABS(C - C1), 3), 8) =

XAVG(XAVG(C1 - C2,3), 8) / XAVG(XAVG(ABS(C1 - C2), 3), 8)

 

Thank you for any help,

Don

Bruce_L
Posted : Thursday, March 23, 2017 11:54:13 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

What is that actually formula supposed to be doing?

I have tested it, so I know it can return true for a few symbols when used as a WatchList Column, but this is only because of rounding issues and because the WatchList Columns use a limited amount of data. It really shouldn't return true for anything that has actually traded otherwise.

I can write approximations for this using the old syntax, but the amount of data being used isn't going to match and you aren't going to get the same results.

(XAVG(XAVGC3, 8) - XAVG(XAVGC3.1, 8)) / (.3113848 * (ABS(C - C1) + 7 / 9 * (ABS(C1 - C2) + 7 / 9 * (ABS(C2 - C3) + 7 / 9 * (ABS(C3 - C4) + 7 / 9 * (ABS(C4 - C5) + 7 / 9 * (ABS(C5 - C6) + 7 / 9 * (ABS(C6 - C7) + 7 / 9 * (ABS(C7 - C8) + 7 / 9 * (ABS(C8 - C9) + 7 / 9 * (ABS(C9 - C10) + 7 / 9 * (ABS(C10 - C11) + 7 / 9 * (ABS(C11 - C12) + 7 / 9 * (ABS(C12 - C13) + 7 / 9 * (ABS(C13 - C14) + 7 / 9 * (ABS(C14 - C15) + 7 / 9 * (ABS(C15 - C16) + 7 / 9 * (ABS(C16 - C17) + 7 / 9 * (ABS(C17 - C18) + 7 / 9 * (ABS(C18 - C19) + 7 / 9 * (ABS(C19 - C20) + 7 / 9 * (ABS(C20 - C21) + 7 / 9 * (ABS(C21 - C22) + 7 / 9 * (ABS(C22 - C23) + 7 / 9 * (ABS(C23 - C24) + 7 / 9 * (ABS(C24 - C25) + 7 / 9 * (ABS(C25 - C26) + 7 / 9 * (ABS(C26 - C27) + 7 / 9 * (ABS(C27 - C28))))))))))))))))))))))))))))) - .2 * (ABS(C - C1) + .5 * (ABS(C1 - C2) + .5 * (ABS(C2 - C3) + .5 * (ABS(C3 - C4) + .5 * (ABS(C4 - C5) + .5 * (ABS(C5 - C6) + .5 * (ABS(C6 - C7) + .5 * (ABS(C7 - C8) + .5 * (ABS(C8 - C9) + .5 * (ABS(C9 - C10) + .5 * (ABS(C10 - C11) + .5 * (ABS(C11 - C12) + .5 * (ABS(C12 - C13) + .5 * (ABS(C13 - C14) + .5 * (ABS(C14 - C15) + .5 * (ABS(C15 - C16) + .5 * (ABS(C16 - C17) + .5 * (ABS(C17 - C18) + .5 * (ABS(C18 - C19) + .5 * (ABS(C19 - C20) + .5 * (ABS(C20 - C21) + .5 * (ABS(C21 - C22) + .5 * (ABS(C22 - C23) + .5 * (ABS(C23 - C24) + .5 * (ABS(C24 - C25) + .5 * (ABS(C25 - C26) + .5 * (ABS(C26 - C27) + .5 * (ABS(C27 - C28)))))))))))))))))))))))))))))) = (XAVG(XAVGC3.1, 8) - XAVG(XAVGC3.2, 8)) / (.3113848 * (ABS(C1 - C2) + 7 / 9 * (ABS(C2 - C3) + 7 / 9 * (ABS(C3 - C4) + 7 / 9 * (ABS(C4 - C5) + 7 / 9 * (ABS(C5 - C6) + 7 / 9 * (ABS(C6 - C7) + 7 / 9 * (ABS(C7 - C8) + 7 / 9 * (ABS(C8 - C9) + 7 / 9 * (ABS(C9 - C10) + 7 / 9 * (ABS(C10 - C11) + 7 / 9 * (ABS(C11 - C12) + 7 / 9 * (ABS(C12 - C13) + 7 / 9 * (ABS(C13 - C14) + 7 / 9 * (ABS(C14 - C15) + 7 / 9 * (ABS(C15 - C16) + 7 / 9 * (ABS(C16 - C17) + 7 / 9 * (ABS(C17 - C18) + 7 / 9 * (ABS(C18 - C19) + 7 / 9 * (ABS(C19 - C20) + 7 / 9 * (ABS(C20 - C21) + 7 / 9 * (ABS(C21 - C22) + 7 / 9 * (ABS(C22 - C23) + 7 / 9 * (ABS(C23 - C24) + 7 / 9 * (ABS(C24 - C25) + 7 / 9 * (ABS(C25 - C26) + 7 / 9 * (ABS(C26 - C27) + 7 / 9 * (ABS(C27 - C28) + 7 / 9 * (ABS(C28 - C29))))))))))))))))))))))))))))) - .2 * (ABS(C1 - C2) + .5 * (ABS(C2 - C3) + .5 * (ABS(C3 - C4) + .5 * (ABS(C4 - C5) + .5 * (ABS(C5 - C6) + .5 * (ABS(C6 - C7) + .5 * (ABS(C7 - C8) + .5 * (ABS(C8 - C9) + .5 * (ABS(C9 - C10) + .5 * (ABS(C10 - C11) + .5 * (ABS(C11 - C12) + .5 * (ABS(C12 - C13) + .5 * (ABS(C13 - C14) + .5 * (ABS(C14 - C15) + .5 * (ABS(C15 - C16) + .5 * (ABS(C16 - C17) + .5 * (ABS(C17 - C18) + .5 * (ABS(C18 - C19) + .5 * (ABS(C19 - C20) + .5 * (ABS(C20 - C21) + .5 * (ABS(C21 - C22) + .5 * (ABS(C22 - C23) + .5 * (ABS(C23 - C24) + .5 * (ABS(C24 - C25) + .5 * (ABS(C25 - C26) + .5 * (ABS(C26 - C27) + .5 * (ABS(C27 - C28) + .5 * (ABS(C28 - C29))))))))))))))))))))))))))))))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
diceman
Posted : Thursday, March 23, 2017 12:05:01 PM
Registered User
Joined: 1/28/2005
Posts: 6,049

QUOTE (diceman)

QUOTE (Bruce_L)

Yes, it is possible to shorten both formulas. A 21 period R-Squared can be written as follows.

(11 * (FAVGC21 - AVGC21) / SQR(110 * (AVG(C ^ 2, 21) - AVGC21 ^ 2) / 3)) ^ 2

 

 

 

 

How would you do a 21 period of an 8EMA?

 

Thanks

donv98
Posted : Thursday, March 23, 2017 12:06:30 PM
Registered User
Joined: 7/29/2010
Posts: 417

Bruce,

  Many thanks for trying.

The pcf looks for identical tsi values over the past 2 bars which can be quite useful.

This clearly demonstrates the limitations of the old syntax.

 

If I were using V. 17 could I use this pcf as written:

XAVG(XAVG(C - C1,3), 8) / XAVG(XAVG(ABS(C - C1), 3), 8) =

XAVG(XAVG(C1 - C2,3), 8) / XAVG(XAVG(ABS(C1 - C2), 3), 8) ?

 

 

Don

Bruce_L
Posted : Thursday, March 23, 2017 12:13:42 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

diceman,

((21 + 1) / 2 * (FAVG(XAVGC8, 21) - AVG(XAVGC8, 21)) / SQR((21 ^ 2 - 1) * (AVG((XAVGC8 ) ^ 2, 21) - AVG(XAVGC8, 21) ^ 2) / 12)) ^ 2

donv98,

The fact that the formulas for the old version are very long is showcasing limitations in the old syntax.

The fact that the results don't match is actually showcasing rounding issues in the program since TSI is never going to be exactly equal two bars in a row for a stock that has actually been trading.

You really should be checking for the difference to be less than some arbitrary value.

ABS(XAVG(XAVG(C - C1,3), 8) / XAVG(XAVG(ABS(C - C1), 3), 8) - XAVG(XAVG(C1 - C2,3), 8) / XAVG(XAVG(ABS(C1 - C2), 3), 8)) <= .001



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
donv98
Posted : Thursday, March 23, 2017 12:31:23 PM
Registered User
Joined: 7/29/2010
Posts: 417

Bruce,

   Thank you very much.

This is very helpful.

I never thought about it in  terms like you presented with rounding errors and that there would not be exact identicality.

I think close enough to identical for me is probably within 0.5,so that's what I will try for the difference.

I am spending time on this because I think  the above pcf is worthy of the efforts.

Thank you for your efforts,

 

Don

Bruce_L
Posted : Thursday, March 23, 2017 12:33:32 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-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.