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 |

Slope of Linear Regression formula and Random Walk Index Code Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Gemini$
Posted : Sunday, June 24, 2018 12:00:53 PM
Registered User
Joined: 2/16/2015
Posts: 8

Dear SIr or Madam,

 I have two questions to ask you.

1) Could you please explain me the formula for the calculation of the slope of the Linear regression line?

6 * (FAVGCx.z - AVGCx.z) / (x - 1)

Why do you multiply by 6, and diivide by (x-1)

In detail I am using the formula to calculate the slope of the linear regression of the 5 period SMA of Price over three time horizons 5, 15, 40. This means that the formulas should be

 

6 * (FAVGC5.5 - AVGC5.5) / (5 - 1)

6 * (FAVGC5.15 - AVGC5.15) / (5 - 1)

6 * (FAVGC5.40 - AVGC5.40) / (5 - 1)

 

2) Is it possible to have the Random Walk Index RWI coded into the TC2000 platform?

Thank you very much for the support.

 

Kind regards.

Bruce_L
Posted : Monday, June 25, 2018 12:06:37 PM


Worden Trainer

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

It is just the way the math works out. If you are really interested in the math behind the formula template, check out bustermu's Tuesday, April 04, 2006 12:12:34 PM ET post in the Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis topic. It doesn't take you all the way there, but it gets you most of the way (just re-arrange the last term). I am not going to go through the entire derivation of the formula.

The 5 period linear regression slope of the 5 period SMA of price can be written as follows.

6 * (FAVG(AVGC5, 5) - AVG(AVGC5, 5) / (5 - 1)

The 15 period linear regression slope of the 5 period SMA of price can be written as follows.

6 * (FAVG(AVGC5, 15) - AVG(AVGC5, 15) / (15 - 1)

The 40 period linear regression slope of the 5 period SMA of price can be wrtitten as follows.

6 * (FAVG(AVGC5, 40) - AVG(AVGC5, 40) / (40 - 1)

The Random Walk Index (RWI) would appear to be a bit more complicated.

There have been some improvements to the Personal Criteria Formula Language since that post, but the syntax still requires significant manual expansion and I really don't have a generalized formula to provide.

9-Period RMI Hi:

GREATEST((H - L1) / (ATR1.1 * SQR(1)), (H - L2) / (ATR1.2 * SQR(2)), (H - L3) / (ATR1.3 * SQR(3)), (H - L4) / (ATR1.4 * SQR(4)), (H - L5) / (ATR1.5 * SQR(5)), (H - L6) / (ATR1.6 * SQR(6)), (H - L7) / (ATR1.7 * SQR(7)), (H - L8) / (ATR1.8 * SQR(8)), (H - L9) / (ATR1.9 * SQR(9)))

9-Peroid RMI Lo:

GREATEST((H1 - L) / (ATR1.1 * SQR(1)), (H2 - L) / (ATR1.2 * SQR(2)), (H3 - L) / (ATR1.3 * SQR(3)), (H4 - L) / (ATR1.4 * SQR(4)), (H5 - L) / (ATR1.5 * SQR(5)), (H6 - L) / (ATR1.6 * SQR(6)), (H7 - L) / (ATR1.7 * SQR(7)), (H8 - L) / (ATR1.8 * SQR(8)), (H9 - L) / (ATR1.9 * SQR(9)))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gemini$
Posted : Monday, June 25, 2018 5:43:10 PM
Registered User
Joined: 2/16/2015
Posts: 8

Thank you very much Bruce, I will try to build the RWI. Do you think it could be done?

 

Bruce_L
Posted : Tuesday, June 26, 2018 8:29:59 AM


Worden Trainer

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

I can help you create formulas for other periods if you let me know what periods you want to use.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gemini$
Posted : Saturday, June 30, 2018 4:28:57 PM
Registered User
Joined: 2/16/2015
Posts: 8

Hi Bruce, sorry for the late reply. You are very kind.

I would use the suggested time periods from Michael Poulos

-1 to 7 for the short term trend

-8 to 64 for the long term trend

Thanks

Bruce_L
Posted : Monday, July 2, 2018 10:03:46 AM


Worden Trainer

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

I am not providing formulas for 64 different periods. I am writing a formula for a 64 period version since it can be shortened to create any of the other formulas.

64-Period RMI Hi:

GREATEST((H - L1) / (ATR1.1 * SQR(1)), (H - L2) / (ATR1.2 * SQR(2)), (H - L3) / (ATR1.3 * SQR(3)), (H - L4) / (ATR1.4 * SQR(4)), (H - L5) / (ATR1.5 * SQR(5)), (H - L6) / (ATR1.6 * SQR(6)), (H - L7) / (ATR1.7 * SQR(7)), (H - L8) / (ATR1.8 * SQR(8)), (H - L9) / (ATR1.9 * SQR(9)), (H - L10) / (ATR1.10 * SQR(10)), (H - L11) / (ATR1.11 * SQR(11)), (H - L12) / (ATR1.12 * SQR(12)), (H - L13) / (ATR1.13 * SQR(13)), (H - L14) / (ATR1.14 * SQR(14)), (H - L15) / (ATR1.15 * SQR(15)), (H - L16) / (ATR1.16 * SQR(16)), (H - L17) / (ATR1.17 * SQR(17)), (H - L18) / (ATR1.18 * SQR(18)), (H - L19) / (ATR1.19 * SQR(19)), (H - L20) / (ATR1.20 * SQR(20)), (H - L21) / (ATR1.21 * SQR(21)), (H - L22) / (ATR1.22 * SQR(22)), (H - L23) / (ATR1.23 * SQR(23)), (H - L24) / (ATR1.24 * SQR(24)), (H - L25) / (ATR1.25 * SQR(25)), (H - L26) / (ATR1.26 * SQR(26)), (H - L27) / (ATR1.27 * SQR(27)), (H - L28) / (ATR1.28 * SQR(28)), (H - L29) / (ATR1.29 * SQR(29)), (H - L30) / (ATR1.30 * SQR(30)), (H - L31) / (ATR1.31 * SQR(31)), (H - L32) / (ATR1.32 * SQR(32)), (H - L33) / (ATR1.33 * SQR(33)), (H - L34) / (ATR1.34 * SQR(34)), (H - L35) / (ATR1.35 * SQR(35)), (H - L36) / (ATR1.36 * SQR(36)), (H - L37) / (ATR1.37 * SQR(37)), (H - L38) / (ATR1.38 * SQR(38)), (H - L39) / (ATR1.39 * SQR(39)), (H - L40) / (ATR1.40 * SQR(40)), (H - L41) / (ATR1.41 * SQR(41)), (H - L42) / (ATR1.42 * SQR(42)), (H - L43) / (ATR1.43 * SQR(43)), (H - L44) / (ATR1.44 * SQR(44)), (H - L45) / (ATR1.45 * SQR(45)), (H - L46) / (ATR1.46 * SQR(46)), (H - L47) / (ATR1.47 * SQR(47)), (H - L48) / (ATR1.48 * SQR(48)), (H - L49) / (ATR1.49 * SQR(49)), (H - L50) / (ATR1.50 * SQR(50)), (H - L51) / (ATR1.51 * SQR(51)), (H - L52) / (ATR1.52 * SQR(52)), (H - L53) / (ATR1.53 * SQR(53)), (H - L54) / (ATR1.54 * SQR(54)), (H - L55) / (ATR1.55 * SQR(55)), (H - L56) / (ATR1.56 * SQR(56)), (H - L57) / (ATR1.57 * SQR(57)), (H - L58) / (ATR1.58 * SQR(58)), (H - L59) / (ATR1.59 * SQR(59)), (H - L60) / (ATR1.60 * SQR(60)), (H - L61) / (ATR1.61 * SQR(61)), (H - L62) / (ATR1.62 * SQR(62)), (H - L63) / (ATR1.63 * SQR(63)), (H - L64) / (ATR1.64 * SQR(64)))

64-Period RMI Lo:

GREATEST((H1 - L) / (ATR1.1 * SQR(1)), (H2 - L) / (ATR1.2 * SQR(2)), (H3 - L) / (ATR1.3 * SQR(3)), (H4 - L) / (ATR1.4 * SQR(4)), (H5 - L) / (ATR1.5 * SQR(5)), (H6 - L) / (ATR1.6 * SQR(6)), (H7 - L) / (ATR1.7 * SQR(7)), (H8 - L) / (ATR1.8 * SQR(8)), (H9 - L) / (ATR1.9 * SQR(9)), (H10 - L) / (ATR1.10 * SQR(10)), (H11 - L) / (ATR1.11 * SQR(11)), (H12 - L) / (ATR1.12 * SQR(12)), (H13 - L) / (ATR1.13 * SQR(13)), (H14 - L) / (ATR1.14 * SQR(14)), (H15 - L) / (ATR1.15 * SQR(15)), (H16 - L) / (ATR1.16 * SQR(16)), (H17 - L) / (ATR1.17 * SQR(17)), (H18 - L) / (ATR1.18 * SQR(18)), (H19 - L) / (ATR1.19 * SQR(19)), (H20 - L) / (ATR1.20 * SQR(20)), (H21 - L) / (ATR1.21 * SQR(21)), (H22 - L) / (ATR1.22 * SQR(22)), (H23 - L) / (ATR1.23 * SQR(23)), (H24 - L) / (ATR1.24 * SQR(24)), (H25 - L) / (ATR1.25 * SQR(25)), (H26 - L) / (ATR1.26 * SQR(26)), (H27 - L) / (ATR1.27 * SQR(27)), (H28 - L) / (ATR1.28 * SQR(28)), (H29 - L) / (ATR1.29 * SQR(29)), (H30 - L) / (ATR1.30 * SQR(30)), (H31 - L) / (ATR1.31 * SQR(31)), (H32 - L) / (ATR1.32 * SQR(32)), (H33 - L) / (ATR1.33 * SQR(33)), (H34 - L) / (ATR1.34 * SQR(34)), (H35 - L) / (ATR1.35 * SQR(35)), (H36 - L) / (ATR1.36 * SQR(36)), (H37 - L) / (ATR1.37 * SQR(37)), (H38 - L) / (ATR1.38 * SQR(38)), (H39 - L) / (ATR1.39 * SQR(39)), (H40 - L) / (ATR1.40 * SQR(40)), (H41 - L) / (ATR1.41 * SQR(41)), (H42 - L) / (ATR1.42 * SQR(42)), (H43 - L) / (ATR1.43 * SQR(43)), (H44 - L) / (ATR1.44 * SQR(44)), (H45 - L) / (ATR1.45 * SQR(45)), (H46 - L) / (ATR1.46 * SQR(46)), (H47 - L) / (ATR1.47 * SQR(47)), (H48 - L) / (ATR1.48 * SQR(48)), (H49 - L) / (ATR1.49 * SQR(49)), (H50 - L) / (ATR1.50 * SQR(50)), (H51 - L) / (ATR1.51 * SQR(51)), (H52 - L) / (ATR1.52 * SQR(52)), (H53 - L) / (ATR1.53 * SQR(53)), (H54 - L) / (ATR1.54 * SQR(54)), (H55 - L) / (ATR1.55 * SQR(55)), (H56 - L) / (ATR1.56 * SQR(56)), (H57 - L) / (ATR1.57 * SQR(57)), (H58 - L) / (ATR1.58 * SQR(58)), (H59 - L) / (ATR1.59 * SQR(59)), (H60 - L) / (ATR1.60 * SQR(60)), (H61 - L) / (ATR1.61 * SQR(61)), (H62 - L) / (ATR1.62 * SQR(62)), (H63 - L) / (ATR1.63 * SQR(63)), (H64 - L) / (ATR1.64 * SQR(64)))

I am also providing a 4 period version.

4-Period RMI Hi:

GREATEST((H - L1) / (ATR1.1 * SQR(1)), (H - L2) / (ATR1.2 * SQR(2)), (H - L3) / (ATR1.3 * SQR(3)), (H - L4) / (ATR1.4 * SQR(4)))

4-Period RMI Lo:

GREATEST((H1 - L) / (ATR1.1 * SQR(1)), (H2 - L) / (ATR1.2 * SQR(2)), (H3 - L) / (ATR1.3 * SQR(3)), (H4 - L) / (ATR1.4 * SQR(4)))

And a 36 period version.

36-Period RMI Hi:

GREATEST((H - L1) / (ATR1.1 * SQR(1)), (H - L2) / (ATR1.2 * SQR(2)), (H - L3) / (ATR1.3 * SQR(3)), (H - L4) / (ATR1.4 * SQR(4)), (H - L5) / (ATR1.5 * SQR(5)), (H - L6) / (ATR1.6 * SQR(6)), (H - L7) / (ATR1.7 * SQR(7)), (H - L8) / (ATR1.8 * SQR(8)), (H - L9) / (ATR1.9 * SQR(9)), (H - L10) / (ATR1.10 * SQR(10)), (H - L11) / (ATR1.11 * SQR(11)), (H - L12) / (ATR1.12 * SQR(12)), (H - L13) / (ATR1.13 * SQR(13)), (H - L14) / (ATR1.14 * SQR(14)), (H - L15) / (ATR1.15 * SQR(15)), (H - L16) / (ATR1.16 * SQR(16)), (H - L17) / (ATR1.17 * SQR(17)), (H - L18) / (ATR1.18 * SQR(18)), (H - L19) / (ATR1.19 * SQR(19)), (H - L20) / (ATR1.20 * SQR(20)), (H - L21) / (ATR1.21 * SQR(21)), (H - L22) / (ATR1.22 * SQR(22)), (H - L23) / (ATR1.23 * SQR(23)), (H - L24) / (ATR1.24 * SQR(24)), (H - L25) / (ATR1.25 * SQR(25)), (H - L26) / (ATR1.26 * SQR(26)), (H - L27) / (ATR1.27 * SQR(27)), (H - L28) / (ATR1.28 * SQR(28)), (H - L29) / (ATR1.29 * SQR(29)), (H - L30) / (ATR1.30 * SQR(30)), (H - L31) / (ATR1.31 * SQR(31)), (H - L32) / (ATR1.32 * SQR(32)), (H - L33) / (ATR1.33 * SQR(33)), (H - L34) / (ATR1.34 * SQR(34)), (H - L35) / (ATR1.35 * SQR(35)), (H - L36) / (ATR1.36 * SQR(36)))

36-Period RMI Lo:

GREATEST((H1 - L) / (ATR1.1 * SQR(1)), (H2 - L) / (ATR1.2 * SQR(2)), (H3 - L) / (ATR1.3 * SQR(3)), (H4 - L) / (ATR1.4 * SQR(4)), (H5 - L) / (ATR1.5 * SQR(5)), (H6 - L) / (ATR1.6 * SQR(6)), (H7 - L) / (ATR1.7 * SQR(7)), (H8 - L) / (ATR1.8 * SQR(8)), (H9 - L) / (ATR1.9 * SQR(9)), (H10 - L) / (ATR1.10 * SQR(10)), (H11 - L) / (ATR1.11 * SQR(11)), (H12 - L) / (ATR1.12 * SQR(12)), (H13 - L) / (ATR1.13 * SQR(13)), (H14 - L) / (ATR1.14 * SQR(14)), (H15 - L) / (ATR1.15 * SQR(15)), (H16 - L) / (ATR1.16 * SQR(16)), (H17 - L) / (ATR1.17 * SQR(17)), (H18 - L) / (ATR1.18 * SQR(18)), (H19 - L) / (ATR1.19 * SQR(19)), (H20 - L) / (ATR1.20 * SQR(20)), (H21 - L) / (ATR1.21 * SQR(21)), (H22 - L) / (ATR1.22 * SQR(22)), (H23 - L) / (ATR1.23 * SQR(23)), (H24 - L) / (ATR1.24 * SQR(24)), (H25 - L) / (ATR1.25 * SQR(25)), (H26 - L) / (ATR1.26 * SQR(26)), (H27 - L) / (ATR1.27 * SQR(27)), (H28 - L) / (ATR1.28 * SQR(28)), (H29 - L) / (ATR1.29 * SQR(29)), (H30 - L) / (ATR1.30 * SQR(30)), (H31 - L) / (ATR1.31 * SQR(31)), (H32 - L) / (ATR1.32 * SQR(32)), (H33 - L) / (ATR1.33 * SQR(33)), (H34 - L) / (ATR1.34 * SQR(34)), (H35 - L) / (ATR1.35 * SQR(35)), (H36 - L) / (ATR1.36 * SQR(36)))

Since these periods fall directly in the middle of the short and long term periods given.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gemini$
Posted : Monday, July 2, 2018 7:24:32 PM
Registered User
Joined: 2/16/2015
Posts: 8

Thanks a lot Bruce, you are really really gentle,. :) :)

Gemini$
Posted : Monday, July 2, 2018 7:31:19 PM
Registered User
Joined: 2/16/2015
Posts: 8

Thanks a lot Bruce, you are really really gentle,. :) :)

thomasjenkinsjr
Posted : Tuesday, July 10, 2018 9:45:17 AM
Registered User
Joined: 4/1/2011
Posts: 90

Hi Bruce,

Can you write a PCF that would give the slope of a line since a particular PCF event was true? 

For example, use the below PCF % true event:

ABS(ABS((L - AVGC21) / 5 / SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 + C11 ^ 2 + C12 ^ 2 + C13 ^ 2 + C14 ^ 2 + C15 ^ 2 + C16 ^ 2 + C17 ^ 2 + C18 ^ 2 + C19 ^ 2 + C20 ^ 2 - 21 * AVGC21 ^ 2) / 21) + .5) > .1) AND ABS(ABS((L1 - AVGC21.1) / 5 / SQR(ABS(C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 + C11 ^ 2 + C12 ^ 2 + C13 ^ 2 + C14 ^ 2 + C15 ^ 2 + C16 ^ 2 + C17 ^ 2 + C18 ^ 2 + C19 ^ 2 + C20 ^ 2 + C21 ^ 2 - 21 * AVGC21.1 ^ 2) / 21) + .5) <= .1)

Thanks in advance.

Bruce_L
Posted : Tuesday, July 10, 2018 10:18:52 AM


Worden Trainer

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

As a general rule, yes, but the practicality of doing so depends on the complexity of the condition. If we simplify the condition somewhat, we would come up with the following formula in TC2000 v18 for the linear regression slope since the condition was most recently true. The formula looks at the most recent 50 bars and returns a division by zero error if the condition was not true during the period.

IIF(XUP(ABS((L - AVGC21) / STDDEV21 + 2.5), .5), 0, IIF(XUP(ABS((L1 - AVGC21.1) / STDDEV21.1 + 2.5), .5), (C - C1) / 6, IIF(XUP(ABS((L2 - AVGC21.2) / STDDEV21.2 + 2.5), .5), FAVGC2 - AVGC2, IIF(XUP(ABS((L3 - AVGC21.3) / STDDEV21.3 + 2.5), .5), (FAVGC3 - AVGC3) / 2, 6 * IIF(XUP(ABS((L4 - AVGC21.4) / STDDEV21.4 + 2.5), .5), (FAVGC4 - AVGC4) / 3, IIF(XUP(ABS((L5 - AVGC21.5) / STDDEV21.5 + 2.5), .5), (FAVGC5 - AVGC5) / 4, IIF(XUP(ABS((L6 - AVGC21.6) / STDDEV21.6 + 2.5), .5), (FAVGC6 - AVGC6) / 5, IIF(XUP(ABS((L7 - AVGC21.7) / STDDEV21.7 + 2.5), .5), (FAVGC7 - AVGC7) / 6, IIF(XUP(ABS((L8 - AVGC21.8) / STDDEV21.8 + 2.5), .5), (FAVGC8 - AVGC8) / 7, IIF(XUP(ABS((L9 - AVGC21.9) / STDDEV21.9 + 2.5), .5), (FAVGC9 - AVGC9) / 8, IIF(XUP(ABS((L10 - AVGC21.10) / STDDEV21.10 + 2.5), .5), (FAVGC10 - AVGC10) / 9, IIF(XUP(ABS((L11 - AVGC21.11) / STDDEV21.11 + 2.5), .5), (FAVGC11 - AVGC11) / 10, IIF(XUP(ABS((L12 - AVGC21.12) / STDDEV21.12 + 2.5), .5), (FAVGC12 - AVGC12) / 11, IIF(XUP(ABS((L13 - AVGC21.13) / STDDEV21.13 + 2.5), .5), (FAVGC13 - AVGC13) / 12, IIF(XUP(ABS((L14 - AVGC21.14) / STDDEV21.14 + 2.5), .5), (FAVGC14 - AVGC14) / 13, IIF(XUP(ABS((L15 - AVGC21.15) / STDDEV21.15 + 2.5), .5), (FAVGC15 - AVGC15) / 14, IIF(XUP(ABS((L16 - AVGC21.16) / STDDEV21.16 + 2.5), .5), (FAVGC16 - AVGC16) / 15, IIF(XUP(ABS((L17 - AVGC21.17) / STDDEV21.17 + 2.5), .5), (FAVGC17 - AVGC17) / 16, IIF(XUP(ABS((L18 - AVGC21.18) / STDDEV21.18 + 2.5), .5), (FAVGC18 - AVGC18) / 17, IIF(XUP(ABS((L19 - AVGC21.19) / STDDEV21.19 + 2.5), .5), (FAVGC19 - AVGC19) / 18, IIF(XUP(ABS((L20 - AVGC21.20) / STDDEV21.20 + 2.5), .5), (FAVGC20 - AVGC20) / 19, IIF(XUP(ABS((L21 - AVGC21.21) / STDDEV21.21 + 2.5), .5), (FAVGC21 - AVGC21) / 20, IIF(XUP(ABS((L22 - AVGC21.22) / STDDEV21.22 + 2.5), .5), (FAVGC22 - AVGC22) / 21, IIF(XUP(ABS((L23 - AVGC21.23) / STDDEV21.23 + 2.5), .5), (FAVGC23 - AVGC23) / 22, IIF(XUP(ABS((L24 - AVGC21.24) / STDDEV21.24 + 2.5), .5), (FAVGC24 - AVGC24) / 23, IIF(XUP(ABS((L25 - AVGC21.25) / STDDEV21.25 + 2.5), .5), (FAVGC25 - AVGC25) / 24, IIF(XUP(ABS((L26 - AVGC21.26) / STDDEV21.26 + 2.5), .5), (FAVGC26 - AVGC26) / 25, IIF(XUP(ABS((L27 - AVGC21.27) / STDDEV21.27 + 2.5), .5), (FAVGC27 - AVGC27) / 26, IIF(XUP(ABS((L28 - AVGC21.28) / STDDEV21.28 + 2.5), .5), (FAVGC28 - AVGC28) / 27, IIF(XUP(ABS((L29 - AVGC21.29) / STDDEV21.29 + 2.5), .5), (FAVGC29 - AVGC29) / 28, IIF(XUP(ABS((L30 - AVGC21.30) / STDDEV21.30 + 2.5), .5), (FAVGC30 - AVGC30) / 29, IIF(XUP(ABS((L31 - AVGC21.31) / STDDEV21.31 + 2.5), .5), (FAVGC31 - AVGC31) / 30, IIF(XUP(ABS((L32 - AVGC21.32) / STDDEV21.32 + 2.5), .5), (FAVGC32 - AVGC32) / 31, IIF(XUP(ABS((L33 - AVGC21.33) / STDDEV21.33 + 2.5), .5), (FAVGC33 - AVGC33) / 32, IIF(XUP(ABS((L34 - AVGC21.34) / STDDEV21.34 + 2.5), .5), (FAVGC34 - AVGC34) / 33, IIF(XUP(ABS((L35 - AVGC21.35) / STDDEV21.35 + 2.5), .5), (FAVGC35 - AVGC35) / 34, IIF(XUP(ABS((L36 - AVGC21.36) / STDDEV21.36 + 2.5), .5), (FAVGC36 - AVGC36) / 35, IIF(XUP(ABS((L37 - AVGC21.37) / STDDEV21.37 + 2.5), .5), (FAVGC37 - AVGC37) / 36, IIF(XUP(ABS((L38 - AVGC21.38) / STDDEV21.38 + 2.5), .5), (FAVGC38 - AVGC38) / 37, IIF(XUP(ABS((L39 - AVGC21.39) / STDDEV21.39 + 2.5), .5), (FAVGC39 - AVGC39) / 38, IIF(XUP(ABS((L40 - AVGC21.40) / STDDEV21.40 + 2.5), .5), (FAVGC40 - AVGC40) / 39, IIF(XUP(ABS((L41 - AVGC21.41) / STDDEV21.41 + 2.5), .5), (FAVGC41 - AVGC41) / 40, IIF(XUP(ABS((L42 - AVGC21.42) / STDDEV21.42 + 2.5), .5), (FAVGC42 - AVGC42) / 41, IIF(XUP(ABS((L43 - AVGC21.43) / STDDEV21.43 + 2.5), .5), (FAVGC43 - AVGC43) / 42, IIF(XUP(ABS((L44 - AVGC21.44) / STDDEV21.44 + 2.5), .5), (FAVGC44 - AVGC44) / 43, IIF(XUP(ABS((L45 - AVGC21.45) / STDDEV21.45 + 2.5), .5), (FAVGC45 - AVGC45) / 44, IIF(XUP(ABS((L46 - AVGC21.46) / STDDEV21.46 + 2.5), .5), (FAVGC46 - AVGC46) / 45, IIF(XUP(ABS((L47 - AVGC21.47) / STDDEV21.47 + 2.5), .5), (FAVGC47 - AVGC47) / 46, IIF(XUP(ABS((L48 - AVGC21.48) / STDDEV21.48 + 2.5), .5), (FAVGC48 - AVGC48) / 47, IIF(XUP(ABS((L49 - AVGC21.49) / STDDEV21.49 + 2.5), .5), (FAVGC49 - AVGC49) / 48, 1 / 0))))))))))))))))))))))))))))))))))))))))))))))))))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
thomasjenkinsjr
Posted : Tuesday, July 10, 2018 10:46:10 AM
Registered User
Joined: 4/1/2011
Posts: 90

Thanks Bruce. This works fine.

I got another question, using the new PCF lanuage in v18 is there an eaiser way to write PCF that will tell you the price percent change since a PCF % event was true?

If so, can you wrie one for this event?

L<L1 AND C>L1 AND WSTOC12.3<10 AND (100 * SUM(IIF(H + L + C > H1 + L1 + C1, (H + L + C) * V, 0), 12) / SUM((H + L + C) * V, 12) < 30)

Thanks

Bruce_L
Posted : Tuesday, July 10, 2018 11:16:46 AM


Worden Trainer

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

Maybe a little bit, but not a lot. Instead of nesting the following.

ABS(true condition) * (value if true) + ABS(false condition) * (next iteration of formula)

You can write it as:

IIF(true condition, value if true, next iteration of formula)

What really would be nice is something more like the following (this is specifically the percent change since true and doesn't work).

100 * (C / C(SinceTrue(true condition, 39)) - 1)

The way we end up having to write this currently is as follows.

100 * (C / IIF(L < L1 AND L1 < C AND WSTOC12.3 < 10 AND 100 * SUM(IIF(H + L + C > H1 + L1 + C1, (H + L + C) * V, 0), 12) / SUM((H + L + C) * V, 12) < 30, C, IIF(L1 < L2 AND L2 < C1 AND WSTOC12.3.1 < 10 AND 100 * SUM(IIF(H1 + L1 + C1 > H2 + L2 + C2, (H1 + L1 + C1) * V1, 0), 12) / SUM((H1 + L1 + C1) * V1, 12) < 30, C1, IIF(L2 < L3 AND L3 < C2 AND WSTOC12.3.2 < 10 AND 100 * SUM(IIF(H2 + L2 + C2 > H3 + L3 + C3, (H2 + L2 + C2) * V2, 0), 12) / SUM((H2 + L2 + C2) * V2, 12) < 30, C2, IIF(L3 < L4 AND L4 < C3 AND WSTOC12.3.3 < 10 AND 100 * SUM(IIF(H3 + L3 + C3 > H4 + L4 + C4, (H3 + L3 + C3) * V3, 0), 12) / SUM((H3 + L3 + C3) * V3, 12) < 30, C3, IIF(L4 < L5 AND L5 < C4 AND WSTOC12.3.4 < 10 AND 100 * SUM(IIF(H4 + L4 + C4 > H5 + L5 + C5, (H4 + L4 + C4) * V4, 0), 12) / SUM((H4 + L4 + C4) * V4, 12) < 30, C4, IIF(L5 < L6 AND L6 < C5 AND WSTOC12.3.5 < 10 AND 100 * SUM(IIF(H5 + L5 + C5 > H6 + L6 + C6, (H5 + L5 + C5) * V5, 0), 12) / SUM((H5 + L5 + C5) * V5, 12) < 30, C5, IIF(L6 < L7 AND L7 < C6 AND WSTOC12.3.6 < 10 AND 100 * SUM(IIF(H6 + L6 + C6 > H7 + L7 + C7, (H6 + L6 + C6) * V6, 0), 12) / SUM((H6 + L6 + C6) * V6, 12) < 30, C6, IIF(L7 < L8 AND L8 < C7 AND WSTOC12.3.7 < 10 AND 100 * SUM(IIF(H7 + L7 + C7 > H8 + L8 + C8, (H7 + L7 + C7) * V7, 0), 12) / SUM((H7 + L7 + C7) * V7, 12) < 30, C7, IIF(L8 < L9 AND L9 < C8 AND WSTOC12.3.8 < 10 AND 100 * SUM(IIF(H8 + L8 + C8 > H9 + L9 + C9, (H8 + L8 + C8) * V8, 0), 12) / SUM((H8 + L8 + C8) * V8, 12) < 30, C8, IIF(L9 < L10 AND L10 < C9 AND WSTOC12.3.9 < 10 AND 100 * SUM(IIF(H9 + L9 + C9 > H10 + L10 + C10, (H9 + L9 + C9) * V9, 0), 12) / SUM((H9 + L9 + C9) * V9, 12) < 30, C9, IIF(L10 < L11 AND L11 < C10 AND WSTOC12.3.10 < 10 AND 100 * SUM(IIF(H10 + L10 + C10 > H11 + L11 + C11, (H10 + L10 + C10) * V10, 0), 12) / SUM((H10 + L10 + C10) * V10, 12) < 30, C10, IIF(L11 < L12 AND L12 < C11 AND WSTOC12.3.11 < 10 AND 100 * SUM(IIF(H11 + L11 + C11 > H12 + L12 + C12, (H11 + L11 + C11) * V11, 0), 12) / SUM((H11 + L11 + C11) * V11, 12) < 30, C11, IIF(L12 < L13 AND L13 < C12 AND WSTOC12.3.12 < 10 AND 100 * SUM(IIF(H12 + L12 + C12 > H13 + L13 + C13, (H12 + L12 + C12) * V12, 0), 12) / SUM((H12 + L12 + C12) * V12, 12) < 30, C12, IIF(L13 < L14 AND L14 < C13 AND WSTOC12.3.13 < 10 AND 100 * SUM(IIF(H13 + L13 + C13 > H14 + L14 + C14, (H13 + L13 + C13) * V13, 0), 12) / SUM((H13 + L13 + C13) * V13, 12) < 30, C13, IIF(L14 < L15 AND L15 < C14 AND WSTOC12.3.14 < 10 AND 100 * SUM(IIF(H14 + L14 + C14 > H15 + L15 + C15, (H14 + L14 + C14) * V14, 0), 12) / SUM((H14 + L14 + C14) * V14, 12) < 30, C14, IIF(L15 < L16 AND L16 < C15 AND WSTOC12.3.15 < 10 AND 100 * SUM(IIF(H15 + L15 + C15 > H16 + L16 + C16, (H15 + L15 + C15) * V15, 0), 12) / SUM((H15 + L15 + C15) * V15, 12) < 30, C15, IIF(L16 < L17 AND L17 < C16 AND WSTOC12.3.16 < 10 AND 100 * SUM(IIF(H16 + L16 + C16 > H17 + L17 + C17, (H16 + L16 + C16) * V16, 0), 12) / SUM((H16 + L16 + C16) * V16, 12) < 30, C16, IIF(L17 < L18 AND L18 < C17 AND WSTOC12.3.17 < 10 AND 100 * SUM(IIF(H17 + L17 + C17 > H18 + L18 + C18, (H17 + L17 + C17) * V17, 0), 12) / SUM((H17 + L17 + C17) * V17, 12) < 30, C17, IIF(L18 < L19 AND L19 < C18 AND WSTOC12.3.18 < 10 AND 100 * SUM(IIF(H18 + L18 + C18 > H19 + L19 + C19, (H18 + L18 + C18) * V18, 0), 12) / SUM((H18 + L18 + C18) * V18, 12) < 30, C18, IIF(L19 < L20 AND L20 < C19 AND WSTOC12.3.19 < 10 AND 100 * SUM(IIF(H19 + L19 + C19 > H20 + L20 + C20, (H19 + L19 + C19) * V19, 0), 12) / SUM((H19 + L19 + C19) * V19, 12) < 30, C19, IIF(L20 < L21 AND L21 < C20 AND WSTOC12.3.20 < 10 AND 100 * SUM(IIF(H20 + L20 + C20 > H21 + L21 + C21, (H20 + L20 + C20) * V20, 0), 12) / SUM((H20 + L20 + C20) * V20, 12) < 30, C20, IIF(L21 < L22 AND L22 < C21 AND WSTOC12.3.21 < 10 AND 100 * SUM(IIF(H21 + L21 + C21 > H22 + L22 + C22, (H21 + L21 + C21) * V21, 0), 12) / SUM((H21 + L21 + C21) * V21, 12) < 30, C21, IIF(L22 < L23 AND L23 < C22 AND WSTOC12.3.22 < 10 AND 100 * SUM(IIF(H22 + L22 + C22 > H23 + L23 + C23, (H22 + L22 + C22) * V22, 0), 12) / SUM((H22 + L22 + C22) * V22, 12) < 30, C22, IIF(L23 < L24 AND L24 < C23 AND WSTOC12.3.23 < 10 AND 100 * SUM(IIF(H23 + L23 + C23 > H24 + L24 + C24, (H23 + L23 + C23) * V23, 0), 12) / SUM((H23 + L23 + C23) * V23, 12) < 30, C23, IIF(L24 < L25 AND L25 < C24 AND WSTOC12.3.24 < 10 AND 100 * SUM(IIF(H24 + L24 + C24 > H25 + L25 + C25, (H24 + L24 + C24) * V24, 0), 12) / SUM((H24 + L24 + C24) * V24, 12) < 30, C24, IIF(L25 < L26 AND L26 < C25 AND WSTOC12.3.25 < 10 AND 100 * SUM(IIF(H25 + L25 + C25 > H26 + L26 + C26, (H25 + L25 + C25) * V25, 0), 12) / SUM((H25 + L25 + C25) * V25, 12) < 30, C25, IIF(L26 < L27 AND L27 < C26 AND WSTOC12.3.26 < 10 AND 100 * SUM(IIF(H26 + L26 + C26 > H27 + L27 + C27, (H26 + L26 + C26) * V26, 0), 12) / SUM((H26 + L26 + C26) * V26, 12) < 30, C26, IIF(L27 < L28 AND L28 < C27 AND WSTOC12.3.27 < 10 AND 100 * SUM(IIF(H27 + L27 + C27 > H28 + L28 + C28, (H27 + L27 + C27) * V27, 0), 12) / SUM((H27 + L27 + C27) * V27, 12) < 30, C27, IIF(L28 < L29 AND L29 < C28 AND WSTOC12.3.28 < 10 AND 100 * SUM(IIF(H28 + L28 + C28 > H29 + L29 + C29, (H28 + L28 + C28) * V28, 0), 12) / SUM((H28 + L28 + C28) * V28, 12) < 30, C28, IIF(L29 < L30 AND L30 < C29 AND WSTOC12.3.29 < 10 AND 100 * SUM(IIF(H29 + L29 + C29 > H30 + L30 + C30, (H29 + L29 + C29) * V29, 0), 12) / SUM((H29 + L29 + C29) * V29, 12) < 30, C29, IIF(L30 < L31 AND L31 < C30 AND WSTOC12.3.30 < 10 AND 100 * SUM(IIF(H30 + L30 + C30 > H31 + L31 + C31, (H30 + L30 + C30) * V30, 0), 12) / SUM((H30 + L30 + C30) * V30, 12) < 30, C30, IIF(L31 < L32 AND L32 < C31 AND WSTOC12.3.31 < 10 AND 100 * SUM(IIF(H31 + L31 + C31 > H32 + L32 + C32, (H31 + L31 + C31) * V31, 0), 12) / SUM((H31 + L31 + C31) * V31, 12) < 30, C31, IIF(L32 < L33 AND L33 < C32 AND WSTOC12.3.32 < 10 AND 100 * SUM(IIF(H32 + L32 + C32 > H33 + L33 + C33, (H32 + L32 + C32) * V32, 0), 12) / SUM((H32 + L32 + C32) * V32, 12) < 30, C32, IIF(L33 < L34 AND L34 < C33 AND WSTOC12.3.33 < 10 AND 100 * SUM(IIF(H33 + L33 + C33 > H34 + L34 + C34, (H33 + L33 + C33) * V33, 0), 12) / SUM((H33 + L33 + C33) * V33, 12) < 30, C33, IIF(L34 < L35 AND L35 < C34 AND WSTOC12.3.34 < 10 AND 100 * SUM(IIF(H34 + L34 + C34 > H35 + L35 + C35, (H34 + L34 + C34) * V34, 0), 12) / SUM((H34 + L34 + C34) * V34, 12) < 30, C34, IIF(L35 < L36 AND L36 < C35 AND WSTOC12.3.35 < 10 AND 100 * SUM(IIF(H35 + L35 + C35 > H36 + L36 + C36, (H35 + L35 + C35) * V35, 0), 12) / SUM((H35 + L35 + C35) * V35, 12) < 30, C35, IIF(L36 < L37 AND L37 < C36 AND WSTOC12.3.36 < 10 AND 100 * SUM(IIF(H36 + L36 + C36 > H37 + L37 + C37, (H36 + L36 + C36) * V36, 0), 12) / SUM((H36 + L36 + C36) * V36, 12) < 30, C36, IIF(L37 < L38 AND L38 < C37 AND WSTOC12.3.37 < 10 AND 100 * SUM(IIF(H37 + L37 + C37 > H38 + L38 + C38, (H37 + L37 + C37) * V37, 0), 12) / SUM((H37 + L37 + C37) * V37, 12) < 30, C37, IIF(L38 < L39 AND L39 < C38 AND WSTOC12.3.38 < 10 AND 100 * SUM(IIF(H38 + L38 + C38 > H39 + L39 + C39, (H38 + L38 + C38) * V38, 0), 12) / SUM((H38 + L38 + C38) * V38, 12) < 30, C38, 1 / 0))))))))))))))))))))))))))))))))))))))) - 1)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
thomasjenkinsjr
Posted : Tuesday, July 10, 2018 11:54:33 AM
Registered User
Joined: 4/1/2011
Posts: 90

Understood..that's the PCF enhancement i'm waiting for.

If i can PLEASE trouble you to do the same with one more PCF % true event (then i'll won't bother you for the rest of the day - i promise).

You'll definitely need to shorten this PCF % true event (because its way too long) and just give me the price percent change for up to 5 bars since this event (or what ever you can do would be apreciated), i'll catch the pattern and figure out how to extend the number of bars.

If it's too long to post, can you send it to me via TCMail?

Thanks in advance.

 

PCF % True event:

((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2) / 12 / AVGV3 + ((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4) / 20 / AVGV5 + ((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7) / 32 / AVGV8 + ((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9) / 40 / AVGV10 + ((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11) / 48 / AVGV12 > ((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29) / 120 / AVGV30 + ((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29 + (O30 + H30 + L30 + C30) * V30 + (O31 + H31 + L31 + C31) * V31 + (O32 + H32 + L32 + C32) * V32 + (O33 + H33 + L33 + C33) * V33 + (O34 + H34 + L34 + C34) * V34) / 140 / AVGV35 + ((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29 + (O30 + H30 + L30 + C30) * V30 + (O31 + H31 + L31 + C31) * V31 + (O32 + H32 + L32 + C32) * V32 + (O33 + H33 + L33 + C33) * V33 + (O34 + H34 + L34 + C34) * V34 + (O35 + H35 + L35 + C35) * V35 + (O36 + H36 + L36 + C36) * V36 + (O37 + H37 + L37 + C37) * V37 + (O38 + H38 + L38 + C38) * V38 + (O39 + H39 + L39 + C39) * V39) / 160 / AVGV40 + ((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29 + (O30 + H30 + L30 + C30) * V30 + (O31 + H31 + L31 + C31) * V31 + (O32 + H32 + L32 + C32) * V32 + (O33 + H33 + L33 + C33) * V33 + (O34 + H34 + L34 + C34) * V34 + (O35 + H35 + L35 + C35) * V35 + (O36 + H36 + L36 + C36) * V36 + (O37 + H37 + L37 + C37) * V37 + (O38 + H38 + L38 + C38) * V38 + (O39 + H39 + L39 + C39) * V39 + (O40 + H40 + L40 + C40) * V40 + (O41 + H41 + L41 + C41) * V41 + (O42 + H42 + L42 + C42) * V42 + (O43 + H43 + L43 + C43) * V43 + (O44 + H44 + L44 + C44) * V44) / 180 / AVGV45 + ((O + H + L + C) * V + (O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29 + (O30 + H30 + L30 + C30) * V30 + (O31 + H31 + L31 + C31) * V31 + (O32 + H32 + L32 + C32) * V32 + (O33 + H33 + L33 + C33) * V33 + (O34 + H34 + L34 + C34) * V34 + (O35 + H35 + L35 + C35) * V35 + (O36 + H36 + L36 + C36) * V36 + (O37 + H37 + L37 + C37) * V37 + (O38 + H38 + L38 + C38) * V38 + (O39 + H39 + L39 + C39) * V39 + (O40 + H40 + L40 + C40) * V40 + (O41 + H41 + L41 + C41) * V41 + (O42 + H42 + L42 + C42) * V42 + (O43 + H43 + L43 + C43) * V43 + (O44 + H44 + L44 + C44) * V44 + (O45 + H45 + L45 + C45) * V45 + (O46 + H46 + L46 + C46) * V46 + (O47 + H47 + L47 + C47) * V47 + (O48 + H48 + L48 + C48) * V48 + (O49 + H49 + L49 + C49) * V49) / 200 / AVGV50 AND ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3) / 12 / AVGV3.1 + ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5) / 20 / AVGV5.1 + ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8) / 32 / AVGV8.1 + ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10) / 40 / AVGV10.1 + ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12) / 48 / AVGV12.1 <= ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29 + (O30 + H30 + L30 + C30) * V30) / 120 / AVGV30.1 + ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29 + (O30 + H30 + L30 + C30) * V30 + (O31 + H31 + L31 + C31) * V31 + (O32 + H32 + L32 + C32) * V32 + (O33 + H33 + L33 + C33) * V33 + (O34 + H34 + L34 + C34) * V34 + (O35 + H35 + L35 + C35) * V35) / 140 / AVGV35.1 + ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29 + (O30 + H30 + L30 + C30) * V30 + (O31 + H31 + L31 + C31) * V31 + (O32 + H32 + L32 + C32) * V32 + (O33 + H33 + L33 + C33) * V33 + (O34 + H34 + L34 + C34) * V34 + (O35 + H35 + L35 + C35) * V35 + (O36 + H36 + L36 + C36) * V36 + (O37 + H37 + L37 + C37) * V37 + (O38 + H38 + L38 + C38) * V38 + (O39 + H39 + L39 + C39) * V39 + (O40 + H40 + L40 + C40) * V40) / 160 / AVGV40.1 + ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29 + (O30 + H30 + L30 + C30) * V30 + (O31 + H31 + L31 + C31) * V31 + (O32 + H32 + L32 + C32) * V32 + (O33 + H33 + L33 + C33) * V33 + (O34 + H34 + L34 + C34) * V34 + (O35 + H35 + L35 + C35) * V35 + (O36 + H36 + L36 + C36) * V36 + (O37 + H37 + L37 + C37) * V37 + (O38 + H38 + L38 + C38) * V38 + (O39 + H39 + L39 + C39) * V39 + (O40 + H40 + L40 + C40) * V40 + (O41 + H41 + L41 + C41) * V41 + (O42 + H42 + L42 + C42) * V42 + (O43 + H43 + L43 + C43) * V43 + (O44 + H44 + L44 + C44) * V44 + (O45 + H45 + L45 + C45) * V45) / 180 / AVGV45.1 + ((O1 + H1 + L1 + C1) * V1 + (O2 + H2 + L2 + C2) * V2 + (O3 + H3 + L3 + C3) * V3 + (O4 + H4 + L4 + C4) * V4 + (O5 + H5 + L5 + C5) * V5 + (O6 + H6 + L6 + C6) * V6 + (O7 + H7 + L7 + C7) * V7 + (O8 + H8 + L8 + C8) * V8 + (O9 + H9 + L9 + C9) * V9 + (O10 + H10 + L10 + C10) * V10 + (O11 + H11 + L11 + C11) * V11 + (O12 + H12 + L12 + C12) * V12 + (O13 + H13 + L13 + C13) * V13 + (O14 + H14 + L14 + C14) * V14 + (O15 + H15 + L15 + C15) * V15 + (O16 + H16 + L16 + C16) * V16 + (O17 + H17 + L17 + C17) * V17 + (O18 + H18 + L18 + C18) * V18 + (O19 + H19 + L19 + C19) * V19 + (O20 + H20 + L20 + C20) * V20 + (O21 + H21 + L21 + C21) * V21 + (O22 + H22 + L22 + C22) * V22 + (O23 + H23 + L23 + C23) * V23 + (O24 + H24 + L24 + C24) * V24 + (O25 + H25 + L25 + C25) * V25 + (O26 + H26 + L26 + C26) * V26 + (O27 + H27 + L27 + C27) * V27 + (O28 + H28 + L28 + C28) * V28 + (O29 + H29 + L29 + C29) * V29 + (O30 + H30 + L30 + C30) * V30 + (O31 + H31 + L31 + C31) * V31 + (O32 + H32 + L32 + C32) * V32 + (O33 + H33 + L33 + C33) * V33 + (O34 + H34 + L34 + C34) * V34 + (O35 + H35 + L35 + C35) * V35 + (O36 + H36 + L36 + C36) * V36 + (O37 + H37 + L37 + C37) * V37 + (O38 + H38 + L38 + C38) * V38 + (O39 + H39 + L39 + C39) * V39 + (O40 + H40 + L40 + C40) * V40 + (O41 + H41 + L41 + C41) * V41 + (O42 + H42 + L42 + C42) * V42 + (O43 + H43 + L43 + C43) * V43 + (O44 + H44 + L44 + C44) * V44 + (O45 + H45 + L45 + C45) * V45 + (O46 + H46 + L46 + C46) * V46 + (O47 + H47 + L47 + C47) * V47 + (O48 + H48 + L48 + C48) * V48 + (O49 + H49 + L49 + C49) * V49 + (O50 + H50 + L50 +C50) * V50) / 200 / AVGV50.1
 
Bruce_L
Posted : Tuesday, July 10, 2018 12:34:16 PM


Worden Trainer

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

The shortend formula is just the following.

XUP(AVG((O + H + L + C) * V, 3) / AVGV3 + AVG((O + H + L + C) * V, 5) / AVGV5 + AVG((O + H + L + C) * V, 8) / AVGV8 + AVG((O + H + L + C) * V, 10) / AVGV10 + AVG((O + H + L + C) * V, 12) / AVGV12, AVG((O + H + L + C) * V, 30) / AVGV30 + AVG((O + H + L + C) * V, 35) / AVGV35 + AVG((O + H + L + C) * V, 40) / AVGV40 + AVG((O + H + L + C) * V, 45) / AVGV45 + AVG((O + H + L + C) * V, 50) / AVGV50)

The percent change since true for the most recent four bars can be written as follows.

100 * (C / IIF(XUP(AVG((O + H + L + C) * V, 3) / AVGV3 + AVG((O + H + L + C) * V, 5) / AVGV5 + AVG((O + H + L + C) * V, 8) / AVGV8 + AVG((O + H + L + C) * V, 10) / AVGV10 + AVG((O + H + L + C) * V, 12) / AVGV12, AVG((O + H + L + C) * V, 30) / AVGV30 + AVG((O + H + L + C) * V, 35) / AVGV35 + AVG((O + H + L + C) * V, 40) / AVGV40 + AVG((O + H + L + C) * V, 45) / AVGV45 + AVG((O + H + L + C) * V, 50) / AVGV50), C, IIF(XUP(AVG((O1 + H1 + L1 + C1) * V1, 3) / AVGV3.1 + AVG((O1 + H1 + L1 + C1) * V1, 5) / AVGV5.1 + AVG((O1 + H1 + L1 + C1) * V1, 8) / AVGV8.1 + AVG((O1 + H1 + L1 + C1) * V1, 10) / AVGV10.1 + AVG((O1 + H1 + L1 + C1) * V1, 12) / AVGV12.1, AVG((O1 + H1 + L1 + C1) * V1, 30) / AVGV30.1 + AVG((O1 + H1 + L1 + C1) * V1, 35) / AVGV35.1 + AVG((O1 + H1 + L1 + C1) * V1, 40) / AVGV40.1 + AVG((O1 + H1 + L1 + C1) * V1, 45) / AVGV45.1 + AVG((O1 + H1 + L1 + C1) * V1, 50) / AVGV50.1), C1, IIF(XUP(AVG((O2 + H2 + L2 + C2) * V2, 3) / AVGV3.2 + AVG((O2 + H2 + L2 + C2) * V2, 5) / AVGV5.2 + AVG((O2 + H2 + L2 + C2) * V2, 8) / AVGV8.2 + AVG((O2 + H2 + L2 + C2) * V2, 10) / AVGV10.2 + AVG((O2 + H2 + L2 + C2) * V2, 12) / AVGV12.2, AVG((O2 + H2 + L2 + C2) * V2, 30) / AVGV30.2 + AVG((O2 + H2 + L2 + C2) * V2, 35) / AVGV35.2 + AVG((O2 + H2 + L2 + C2) * V2, 40) / AVGV40.2 + AVG((O2 + H2 + L2 + C2) * V2, 45) / AVGV45.2 + AVG((O2 + H2 + L2 + C2) * V2, 50) / AVGV50.2), C2, IIF(XUP(AVG((O3 + H3 + L3 + C3) * V3, 3) / AVGV3.3 + AVG((O3 + H3 + L3 + C3) * V3, 5) / AVGV5.3 + AVG((O3 + H3 + L3 + C3) * V3, 8) / AVGV8.3 + AVG((O3 + H3 + L3 + C3) * V3, 10) / AVGV10.3 + AVG((O3 + H3 + L3 + C3) * V3, 12) / AVGV12.3, AVG((O3 + H3 + L3 + C3) * V3, 30) / AVGV30.3 + AVG((O3 + H3 + L3 + C3) * V3, 35) / AVGV35.3 + AVG((O3 + H3 + L3 + C3) * V3, 40) / AVGV40.3 + AVG((O3 + H3 + L3 + C3) * V3, 45) / AVGV45.3 + AVG((O3 + H3 + L3 + C3) * V3, 50) / AVGV50.3), C3, 1 / 0)))) - 1)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
thomasjenkinsjr
Posted : Wednesday, July 11, 2018 4:18:57 PM
Registered User
Joined: 4/1/2011
Posts: 90

Hi Bruce,

First of all, thanks for all your help. Can you write a PCF that will tell me the price percent change on the below PCF % True event? up to 20 bars if possible.

 

L<L1 AND H>L1

Thanks in advance.

Bruce_L
Posted : Wednesday, July 11, 2018 4:27:50 PM


Worden Trainer

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

Please try the following indicator formula.

100 * (C / IIF(L < L1 AND L1 < H, C, IIF(L1 < L2 AND L2 < H1, C1, IIF(L2 < L3 AND L3 < H2, C2, IIF(L3 < L4 AND L4 < H3, C3, IIF(L4 < L5 AND L5 < H4, C4, IIF(L5 < L6 AND L6 < H5, C5, IIF(L6 < L7 AND L7 < H6, C6, IIF(L7 < L8 AND L8 < H7, C7, IIF(L8 < L9 AND L9 < H8, C8, IIF(L9 < L10 AND L10 < H9, C9, IIF(L10 < L11 AND L11 < H10, C10, IIF(L11 < L12 AND L12 < H11, C11, IIF(L12 < L13 AND L13 < H12, C12, IIF(L13 < L14 AND L14 < H13, C13, IIF(L14 < L15 AND L15 < H14, C14, IIF(L15 < L16 AND L16 < H15, C15, IIF(L16 < L17 AND L17 < H16, C16, IIF(L17 < L18 AND L18 < H17, C17, IIF(L18 < L19 AND L19 < H18, C18, IIF(L19 < L20 AND L20 < H19, C19, IIF(L20 < L21 AND L21 < H20, C20, 1 / 0))))))))))))))))))))) - 1)



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