Registered User Joined: 7/14/2007 Posts: 9
|
re: TC2000 version 7 software
How could I write a PCF and chart indicator of True Strength Index (TSI) using Weighted Moving Averages (WMA) for a PCF and a chart indicator?
The TSI formula would be:
TSI = WMA(WMA(NetChange,Long),Short) / WMA(WMA(AbsNetChange(n),Long),Short)
Where:
WMA = (front) Weighted Moving Average
Long = Long Period = 100 bars
Short = Short Period = 20 bars
NetChange = Typical Price - Typical Price 1 bar ago = (H+L+C)/3 - (H1+L1+C1)/3
AbsNetChange = Absolute value of Typical Price - Typical Price 1 bar ago = ABS((H+L+C)/3 - (H1+L1+C1)/3)
So, substituting values:
TSI = WMA(WMA((H+L+C)/3 - (H1+L1+C1)/3, 100),20) / WMA(WMA(ABS((H+L+C)/3 - (H1+L1+C1)/3), 100),20)
Despite seeing some TSI and WMA formulas separately on the Forum*, I’m unsure how to combine them to create a TSI using WMA. Is it feasible?
*From searches of the Forum for terms TSI, true strength index, WMA, and weighted average, I see that TC2000: (a) defines TSI with XAVG (exponential MA), rather than WMA, and (b) does not have a formula for WMA.
Thanks in advance for any help!
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I think an Indicator Formula for your version of a TSI 100, 20 to be used in TC2000 version 7 could be written as:
(2000 * (H + L + C) + 1880 * (H1 + L1 + C1) + 1761 * (H2 + L2 + C2) + 1643 * (H3 + L3 + C3) + 1526 * (H4 + L4 + C4) + 1410 * (H5 + L5 + C5) + 1295 * (H6 + L6 + C6) + 1181 * (H7 + L7 + C7) + 1068 * (H8 + L8 + C8) + 956 * (H9 + L9 + C9) + 845 * (H10 + L10 + C10) + 735 * (H11 + L11 + C11) + 626 * (H12 + L12 + C12) + 518 * (H13 + L13 + C13) + 411 * (H14 + L14 + C14) + 305 * (H15 + L15 + C15) + 200 * (H16 + L16 + C16) + 96 * (H17 + L17 + C17) - 7 * (H18 + L18 + C18) - 17010 * (AVGH81.20 + AVGL81.20 + AVGC81.20) - 190 * (H101 + L101 + C101) - 171 * (H102 + L102 + C102) - 153 * (H103 + L103 + C103) - 136 * (H104 + L104 + C104) - 120 * (H105 + L105 + C105) - 105 * (H106 + L106 + C106) - 91 * (H107 + L107 + C107) - 78 * (H108 + L108 + C108) - 66 * (H109 + L109 + C109) - 55 * (H110 + L110 + C110) - 45 * (H111 + L111 + C111) - 36 * (H112 + L112 + C112) - 28 * (H113 + L113 + C113) - 21 * (H114 + L114 + C114) - 15 * (H115 + L115 + C115) - 10 * (H116 + L116 + C116) - 6 * (H117 + L117 + C117) - 3 * (H118 + L118 + C118) - H119 - L119 - C119) / (2000 *ABS(H + L + C - H1 - L1 - C1) + 3880 * ABS(H1 + L1 + C1 - H2 - L2 - C2) + 5641 * ABS(H2 + L2 + C2 - H3 - L3 - C3) + 7284 * ABS(H3 + L3 + C3 - H4 - L4 - C4) + 8810 * ABS(H4 + L4 + C4 - H5 - L5 - C5) + 10220 * ABS(H5 + L5 + C5 - H6 - L6 - C6) + 11515 * ABS(H6 + L6 + C6 - H7 - L7 - C7) + 12696 * ABS(H7 + L7 + C7 - H8 - L8 - C8) + 13764 * ABS(H8 + L8 + C8 - H9 - L9 - C9) + 14720 * ABS(H9 + L9 + C9 - H10 - L10 - C10) + 15565 * ABS(H10 + L10 + C10 - H11 - L11 - C11) + 16300 * ABS(H11 + L11 + C11 - H12 - L12 - C12) + 16926 * ABS(H12 + L12 + C12 - H13 - L13 - C13) + 17444 * ABS(H13 + L13 + C13 - H14 - L14 - C14) + 17855 * ABS(H14 + L14 + C14 - H15 - L15 - C15) + 18160 * ABS(H15 + L15 + C15 - H16 - L16 - C16) + 18360 * ABS(H16 + L16 + C16 - H17 - L17 - C17) + 18456 * ABS(H17 + L17 + C17 - H18 - L18 - C18) + 18449 * ABS(H18 + L18 + C18 - H19 - L19 - C19) + 18340 * ABS(H19 + L19 + C19 - H20 - L20 - C20) + 18130 * ABS(H20 + L20 + C20 - H21 - L21 - C21) + 17920 * ABS(H21 + L21 + C21 - H22 - L22 - C22) + 17710 * ABS(H22 + L22 + C22 - H23 - L23 - C23) + 17500 * ABS(H23 + L23 + C23 - H24 - L24 - C24) + 17290 * ABS(H24 + L24 + C24 - H25 - L25 - C25) + 17080 * ABS(H25 + L25 + C25 - H26 - L26 - C26) + 16870 * ABS(H26 + L26 + C26 - H27 - L27 - C27) + 16660 * ABS(H27 + L27 + C27 - H28 - L28 - C28) + 16450 * ABS(H28 + L28 + C28 - H29 - L29 - C29) + 16240 * ABS(H29 + L29 + C29 - H30 - L30 - C30) + 16030 * ABS(H30 + L30 + C30 - H31 - L31 - C31) + 15820 * ABS(H31 + L31 + C31 - H32 - L32 - C32) + 15610 * ABS(H32 + L32 + C32 - H33 - L33 - C33) + 15400 * ABS(H33 + L33 + C33 - H34 - L34 - C34) + 15190 * ABS(H34 + L34 + C34 - H35 - L35 - C35) + 14980 * ABS(H35 + L35 + C35 - H36 - L36 - C36) + 14770 * ABS(H36 + L36 + C36 - H37 - L37 - C37) + 14560 * ABS(H37 + L37 + C37 - H38 - L38 - C38) + 14350 * ABS(H38 + L38 + C38 - H39 - L39 - C39) + 14140 * ABS(H39 + L39 + C39 - H40 - L40 - C40) + 13930 * ABS(H40 + L40 + C40 - H41 - L41 - C41) + 13720 * ABS(H41 + L41 + C41 - H42 - L42 - C42) + 13510 * ABS(H42 + L42 + C42 - H43 - L43 - C43) + 13300 * ABS(H43 + L43 + C43 - H44 - L44 - C44) + 13090 * ABS(H44 + L44 + C44 - H45 - L45 - C45) + 12880 * ABS(H45 + L45 + C45 - H46 - L46 - C46) + 12670 * ABS(H46 + L46 + C46 - H47 - L47 - C47) + 12460 * ABS(H47 + L47 + C47 - H48 - L48 - C48) + 12250 * ABS(H48 + L48 + C48 - H49 - L49 - C49) + 12040 * ABS(H49 + L49 + C49 - H50 - L50 - C50) + 11830 * ABS(H50 + L50 + C50 - H51 - L51 - C51) + 11620 * ABS(H51 + L51 + C51 - H52 - L52 - C52) + 11410 * ABS(H52 + L52 + C52 - H53 - L53 - C53) + 11200 * ABS(H53 + L53 + C53 - H54 - L54 - C54) + 10990 * ABS(H54 + L54 + C54 - H55 - L55 - C55) + 10780 * ABS(H55 + L55 + C55 - H56 - L56 - C56) + 10570 * ABS(H56 + L56 + C56 - H57 - L57 - C57) + 10360 * ABS(H57 + L57 + C57 - H58 - L58 - C58) + 10150 * ABS(H58 + L58 + C58 - H59 - L59 - C59) + 9940 * ABS(H59 + L59 + C59 - H60 - L60 - C60) + 9730 * ABS(H60 + L60 + C60 - H61 - L61 - C61) + 9520 * ABS(H61 + L61 + C61 - H62 - L62 - C62) + 9310 * ABS(H62 + L62 + C62 - H63 - L63 - C63) + 9100 * ABS(H63 + L63 + C63 - H64 - L64 - C64) + 8890 * ABS(H64 + L64 + C64 - H65 - L65 - C65) + 8680 * ABS(H65 + L65 + C65 - H66 - L66 - C66) + 8470 * ABS(H66 + L66 + C66 - H67 - L67 - C67) + 8260 * ABS(H67 + L67 + C67 - H68 - L68 - C68) + 8050 * ABS(H68 + L68 + C68 - H69 - L69 - C69) + 7840 * ABS(H69 + L69 + C69 - H70 - L70 - C70) + 7630 * ABS(H70 + L70 + C70 - H71 - L71 - C71) + 7420 * ABS(H71 + L71 + C71 - H72 - L72 - C72) + 7210 * ABS(H72 + L72 + C72 - H73 - L73 - C73) + 7000 * ABS(H73 + L73 + C73 - H74 - L74 - C74) + 6790 * ABS(H74 + L74 + C74 - H75 - L75 - C75) + 6580 * ABS(H75 + L75 + C75 - H76 - L76 - C76) + 6370 * ABS(H76 + L76 + C76 - H77 - L77 - C77) + 6160 * ABS(H77 + L77 + C77 - H78 - L78 - C78) + 5950 * ABS(H78 + L78 + C78 - H79 - L79 - C79) + 5740 * ABS(H79 + L79 + C79 - H80 - L80 - C80) + 5530 * ABS(H80 + L80 + C80 - H81 - L81 - C81) + 5320 * ABS(H81 + L81 + C81 - H82 - L82 - C82) + 5110 * ABS(H82 + L82 + C82 - H83 - L83 - C83) + 4900 * ABS(H83 + L83 + C83 - H84 - L84 - C84) + 4690 * ABS(H84 + L84 + C84 - H85 - L85 - C85) + 4480 * ABS(H85 + L85 + C85 - H86 - L86 - C86) + 4270 * ABS(H86 + L86 + C86 - H87 - L87 - C87) + 4060 * ABS(H87 + L87 + C87 - H88 - L88 - C88) + 3850 * ABS(H88 + L88 + C88 - H89 - L89 - C89) + 3640 * ABS(H89 + L89 + C89 - H90 - L90 - C90) + 3430 * ABS(H90 + L90 + C90 - H91 - L91 - C91) + 3220 * ABS(H91 + L91 + C91 - H92 - L92 - C92) + 3010 * ABS(H92 + L92 + C92 - H93 - L93 - C93) + 2800 * ABS(H93 + L93 + C93 - H94 - L94 - C94) + 2590 * ABS(H94 + L94 + C94 - H95 - L95 - C95) + 2380 * ABS(H95 + L95 + C95 - H96 - L96 - C96) + 2170 * ABS(H96 + L96 + C96 - H97 - L97 - C97) + 1960 * ABS(H97 + L97 + C97 - H98 - L98 - C98) + 1750 * ABS(H98 + L98 + C98 - H99 - L99 - C99) + 1540 * ABS(H99 + L99 + C99 - H100 - L100 - C100) + 1330 * ABS(H100 + L100 + C100 - H101 - L101 - C101) + 1140 * ABS(H101 + L101 + C101 - H102 - L102 - C102) + 969 * ABS(H102 + L102 + C102 - H103 - L103 - C103) + 816 * ABS(H103 + L103 + C103 - H104 - L104 - C104) + 680 * ABS(H104 + L104 + C104 - H105 - L105 - C105) + 560 * ABS(H105 + L105 + C105 - H106 - L106 - C106) + 455 * ABS(H106 + L106 + C106 - H107 - L107 - C107) + 364 * ABS(H107 + L107 + C107 - H108 - L108 - C108) + 286 * ABS(H108 + L108 + C108 - H109 - L109 - C109) + 220 * ABS(H109 + L109 + C109 - H110 - L110 - C110) + 165 * ABS(H110 + L110 + C110 - H111 - L111 - C111) + 120 * ABS(H111 + L111 + C111 - H112 - L112 - C112) + 84 * ABS(H112 + L112 + C112 - H113 - L113 - C113) + 56 * ABS(H113 + L113 + C113 - H114 - L114 - C114) + 35 * ABS(H114 + L114 + C114 - H115 - L115 - C115) + 20 * ABS(H115 + L115 + C115 - H116 - L116 - C116) + 10 * ABS(H116 + L116 + C116 - H117 - L117 - C117) + 4 * ABS(H117 + L117 + C117 - H118 - L118 - C118) + ABS(H118 + L118 + C118 - H119 - L119 - C119))
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 7/14/2007 Posts: 9
|
THANKS, Bruce!
Awesome--formula works fine. How do you do this so fast?
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I create really long formulas like this one using a spreadsheet.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 3/20/2011 Posts: 25
|
Do you have a general formula for calculating a WMA(i,p) (Weighted Moving Average(Close,Periods)} that you can share, please?
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
A Front Weighted Moving Average just starts by multiplying the current bar by the period and subtracting one from that for each bar further in the past until you hit zero. You then need to divide the result by the sum of the factors. So a 2-Period Front Weighted Moving Average would be:
(2 * C + C1) / 3
A 3-Period Front Weighted Moving Average would be:
(3 * C + 2 * C1 + C2) / 6
A 4-Period Front Weighted Moving Average woulld be:
(4 * C + 3 * C1 + 2 * C2 + C3) / 10
A 5-Period Front Weighted Moving Average would be:
(5 * C + 4 * C1 + 3 * C2 + 2 * C3 + C4) / 15
The pattern continues as the period increases.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|