Registered User Joined: 12/30/2004 Posts: 11
|
I am looking to write a PCF for a 20 period Hull moving average indicator.
One would be for the HMA to be at 20 HMA yesterday and less then 20 HMA today.
The other would be for the HMA to be below 20 HMA yesterday and more then 20 HMA today.
Any help would be appreciated, thanks.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Welcome to the forums. A very good foundation for learning how to use TeleChart can be gained by reviewing the following:
If you are new to TeleChart READ THIS FIRST!
One way to write a formula for a 20-Period Hull Moving Average is:
124 * C / 1155 + 92 * C1 / 525 + 4777 * C2 / 23100 + 79 * C3 / 385 + 401 * C4 / 2310 + 164 * C5 / 1155 + 17 * C6 / 154 + 13 * C7 / 165 + 109 * C8 / 2310 + 6 * C9 / 385 - 37 * C10 / 2310 - 191 * C11 / 5775 - 151 * C12 / 3850 - 4 * C13 / 105 - C14 / 30 - C15 / 35 - C16 / 42 - 2 * C17 / 105 - C18 / 70 - C19 / 105 - C20 / 210 - C21 / 525 - C22 / 2100
One way to write a formula for Price crossing up through its 20-Period HMA would be:
C > 124 * C / 1155 + 92 * C1 / 525 + 4777 * C2 / 23100 + 79 * C3 / 385 + 401 * C4 / 2310 + 164 * C5 / 1155 + 17 * C6 / 154 + 13 * C7 / 165 + 109 * C8 / 2310 + 6 * C9 / 385 - 37 * C10 / 2310 - 191 * C11 / 5775 - 151 * C12 / 3850 - 4 * C13 / 105 - C14 / 30 - C15 / 35 - C16 / 42 - 2 * C17 / 105 - C18 / 70 - C19 / 105 - C20 / 210 - C21 / 525 - C22 / 2100 AND C1 <= 124 * C1 / 1155 + 92 * C2 / 525 + 4777 * C3 / 23100 + 79 * C4 / 385 + 401 * C5 / 2310 + 164 * C6 / 1155 + 17 * C7 / 154 + 13 * C8 / 165 + 109 * C9 / 2310 + 6 * C10 / 385 - 37 * C11 / 2310 - 191 * C12 / 5775 - 151 * C13 / 3850 - 4 * C14 / 105 - C15 / 30 - C16 / 35 - C17 / 42 - 2 * C18 / 105 - C19 / 70 - C20 / 105 - C21 / 210 - C22 / 525 - C23 / 2100
One way to write a formula for Price crossing down through its 20-Period HMA would be:
C < 124 * C / 1155 + 92 * C1 / 525 + 4777 * C2 / 23100 + 79 * C3 / 385 + 401 * C4 / 2310 + 164 * C5 / 1155 + 17 * C6 / 154 + 13 * C7 / 165 + 109 * C8 / 2310 + 6 * C9 / 385 - 37 * C10 / 2310 - 191 * C11 / 5775 - 151 * C12 / 3850 - 4 * C13 / 105 - C14 / 30 - C15 / 35 - C16 / 42 - 2 * C17 / 105 - C18 / 70 - C19 / 105 - C20 / 210 - C21 / 525 - C22 / 2100 AND C1 >= 124 * C1 / 1155 + 92 * C2 / 525 + 4777 * C3 / 23100 + 79 * C4 / 385 + 401 * C5 / 2310 + 164 * C6 / 1155 + 17 * C7 / 154 + 13 * C8 / 165 + 109 * C9 / 2310 + 6 * C10 / 385 - 37 * C11 / 2310 - 191 * C12 / 5775 - 151 * C13 / 3850 - 4 * C14 / 105 - C15 / 30 - C16 / 35 - C17 / 42 - 2 * C18 / 105 - C19 / 70 - C20 / 105 - C21 / 210 - C22 / 525 - C23 / 2100
The first formula returns the Value of the 20-Period Hull Moving Average. The second and third formulas are Boolean (True or False) and could be used as EasyScan Conditions. You may wish to review the following:
Hull Moving Average
Plotting Custom Indicators with Examples
How to create a Personal Criteria Forumula (PCF)
Using EasyScan to find stocks that meet your own criteria
PCF Formula Descriptions
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
Thank you for your help.
I guess I didn't explain myself too well.
I now have the 20 day HMA as a custom indicator on all my charts.
What I want to see now are all the charts that had HMA at 20 yesterday and today the HMA is less than 20,
and vice versa for charts that had HMA at 20 yesterday and today the HMA is more than 20.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
My original response included formulas for Price crossing up through and down through the 20-Period Hull Moving Average in addition to the formula for the Value of the 20-Period Hull Hoving Average.
These are the second and third formulas and are clearly labeled as to what they do. This was how I interpreted the "HMA to be at 20 HMA yesterday and less then 20 HMA today" and "HMA to be below 20 HMA yesterday and more then 20 HMA today" as I assumed the first HMA to be a mistatement on your part that meant Price since the HMA is always equal to itself and cannot be above or below itself.
You have rephrased this today as "HMA at 20 yesterday and today the HMA is less than 20" and "HMA at 20 yesterday and today the HMA is more than 20". This would seem to be looking for the HMA to be crossing through 20 instead (even though contemplating the utility of such an interpretation might weight against it).
One way to write a formula for a 20-Period Hull Moving Average crossing up through 20 is:
124 * C / 1155 + 92 * C1 / 525 + 4777 * C2 / 23100 + 79 * C3 / 385 + 401 * C4 / 2310 + 164 * C5 / 1155 + 17 * C6 / 154 + 13 * C7 / 165 + 109 * C8 / 2310 + 6 * C9 / 385 - 37 * C10 / 2310 - 191 * C11 / 5775 - 151 * C12 / 3850 - 4 * C13 / 105 - C14 / 30 - C15 / 35 - C16 / 42 - 2 * C17 / 105 - C18 / 70 - C19 / 105 - C20 / 210 - C21 / 525 - C22 / 2100 > 20 AND 124 * C1 / 1155 + 92 * C2 / 525 + 4777 * C3 / 23100 + 79 * C4 / 385 + 401 * C5 / 2310 + 164 * C6 / 1155 + 17 * C7 / 154 + 13 * C8 / 165 + 109 * C9 / 2310 + 6 * C10 / 385 - 37 * C11 / 2310 - 191 * C12 / 5775 - 151 * C13 / 3850 - 4 * C14 / 105 - C15 / 30 - C16 / 35 - C17 / 42 - 2 * C18 / 105 - C19 / 70 - C20 / 105 - C21 / 210 - C22 / 525 - C23 / 2100 <= 20
One way to write a formula for a 20-Period Hull Moving Average crossing down through 20 is:
124 * C / 1155 + 92 * C1 / 525 + 4777 * C2 / 23100 + 79 * C3 / 385 + 401 * C4 / 2310 + 164 * C5 / 1155 + 17 * C6 / 154 + 13 * C7 / 165 + 109 * C8 / 2310 + 6 * C9 / 385 - 37 * C10 / 2310 - 191 * C11 / 5775 - 151 * C12 / 3850 - 4 * C13 / 105 - C14 / 30 - C15 / 35 - C16 / 42 - 2 * C17 / 105 - C18 / 70 - C19 / 105 - C20 / 210 - C21 / 525 - C22 / 2100 < 20 AND 124 * C1 / 1155 + 92 * C2 / 525 + 4777 * C3 / 23100 + 79 * C4 / 385 + 401 * C5 / 2310 + 164 * C6 / 1155 + 17 * C7 / 154 + 13 * C8 / 165 + 109 * C9 / 2310 + 6 * C10 / 385 - 37 * C11 / 2310 - 191 * C12 / 5775 - 151 * C13 / 3850 - 4 * C14 / 105 - C15 / 30 - C16 / 35 - C17 / 42 - 2 * C18 / 105 - C19 / 70 - C20 / 105 - C21 / 210 - C22 / 525 - C23 / 2100 >= 20
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
Thank you for your effort. I am not describing my question property.
How can I include a chart for this discussion?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The Inserting A Chart into A Worden post topic is the best topic of which I am aware on how to include charts in your forum posts.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
Would it be possible for you to post any 8 month chart with a 20 day simple moving avg on it as an example I could use. I am not that handy with the instructions for inserting a chart in a posting. Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Attachments: lsmah47120.gif - 15 KB, downloaded 10,573 time(s).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
Thank you.
On 20 Jan 10, that's the peak of the 20 sma, on 21 Jan 10, the 20sma turns down(less than 20), it is now lower than 20sma, The day after the 20 sma peak, I would like to see all the charts with this criteria.
The same when the 20 sma turns up from the bottom, 16 Feb.10.
All the above using the HMA 20.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (lsmah) On 20 Jan 10, that's the peak of the 20 sma, on 21 Jan 10, the 20sma turns down(less than 20), it is now lower than 20sma, The day after the 20 sma peak, I would like to see all the charts with this criteria.
This formula was already provided. It is the third formula in my Monday, May 10, 2010 10:10:33 AM ET post.
QUOTE (lsmah) The same when the 20 sma turns up from the bottom, 16 Feb.10.
This formula was already provided. It is the second formula in my Monday, May 10, 2010 10:10:33 AM ET post.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
I think the formulae you provided are stock price dependent and not the 20 HMA indicator dependent.
I tried them already. I don't want to see stocks tie to the indicator but when the indicators indicate a turn.
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
Just to clarify, if that's possible, imagine the chart you posted is blacked out from 22 Jan 10 on wards.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
When used as Custom Percent True Indicators, the second (green) and third (red) formulas from my Monday, May 10, 2010 10:10:33 AM ET post line up exactly with the crossings of the 20-Period Hull Moving Average.
Visually Backtesting Specific Symbols
When used as EasyScan Conditions in their own EasyScan, they bring up a list of symbols where the crossover happened between the previous and current Daily Bars.
Using EasyScan to find stocks that meet your own criteria
I'm really not understanding what you want different.Attachments: lsmah47120-2.gif - 21 KB, downloaded 10,495 time(s).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
It's my fault. What we have here is my failure to communicate properly.
Let's start over again.
I have the HMA 20day custom indicator on all my stock charts.
Let's take the case where the HMA 20 is going up on a stock chart.
It (HMA 20)goes up and up and eventually it peaks and flattens out and goes down.
What I would like to see are the charts that show the HMA 20 has peaked and turn down.
The same applies for the case where the HMA 20 goes down and then turns up.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (lsmah) What I would like to see are the charts that show the HMA 20 has peaked and turn down.
A formula for the current HMA20 being less than the previous HMA20 and the previous HMA20 being greater than the HMA20 from the Bar before that would be:
2480 * C + 1568 * C1 + 729 * C2 + 26 * C13 + 110 * C14 + 110 * C15 + 110 * C16 + 110 * C17 + 110 * C18 + 110 * C19 + 110 * C20 + 66 * C21 + 33 * C22 + 11 * C23 < 37 * C3 + 730 * C4 + 730 * C5 + 730 * C6 + 730 * C7 + 730 * C8 + 730 * C9 + 730 * C10 + 394 * C11 + 142 * C12 AND 2480 * C1 + 1568 * C2 + 729 * C3 + 26 * C14 + 110 * C15 + 110 * C16 + 110 * C17 + 110 * C18 + 110 * C19 + 110 * C20 + 110 * C21 + 66 * C22 + 33 * C23 + 11 * C24 > 37 * C4 + 730 * C5 + 730 * C6 + 730 * C7 + 730 * C8 + 730 * C9 + 730 * C10 + 730 * C11 + 394 * C12 + 142 * C13
QUOTE (lsmah) The same applies for the case where the HMA 20 goes down and then turns up.
A formula for the current HMA20 being greater than the previous HMA20 and the previous HMA20 being less than the HMA20 from the Bar before that would be:
2480 * C + 1568 * C1 + 729 * C2 + 26 * C13 + 110 * C14 + 110 * C15 + 110 * C16 + 110 * C17 + 110 * C18 + 110 * C19 + 110 * C20 + 66 * C21 + 33 * C22 + 11 * C23 > 37 * C3 + 730 * C4 + 730 * C5 + 730 * C6 + 730 * C7 + 730 * C8 + 730 * C9 + 730 * C10 + 394 * C11 + 142 * C12 AND 2480 * C1 + 1568 * C2 + 729 * C3 + 26 * C14 + 110 * C15 + 110 * C16 + 110 * C17 + 110 * C18 + 110 * C19 + 110 * C20 + 110 * C21 + 66 * C22 + 33 * C23 + 11 * C24 < 37 * C4 + 730 * C5 + 730 * C6 + 730 * C7 + 730 * C8 + 730 * C9 + 730 * C10 + 730 * C11 + 394 * C12 + 142 * C13
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
Thank you for your patience.
The PCF's worked well.
Now I would like to have custom indicators for:
40 period HMA
100 period HMA
Would it be easier if you teach me how to do it or just post them for me.
I am in no hurry for them so do them whenever you have time.
Thanks in advance.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
One way to write a formula for a 40-Period Hull Moving Average is:
(14640 * C + 25982 * C1 + 34169 * C2 + 39344 * C3 + 41650 * C4 + 41230 * C5 + 38227 * C6 + 35224 * C7 + 32221 * C8 + 29218 * C9 + 26215 * C10 + 23212 * C11 + 20209 * C12 + 17206 * C13 + 14203 * C14 + 11200 * C15 + 8197 * C16 + 5194 * C17 + 2191 * C18 - 812 * C19 - 3815 * C20 - 5834 * C21 - 7033 * C22 - 7576 * C23 - 7627 * C24 - 7350 * C25 - 6909 * C26 - 6468 * C27 - 6027 * C28 - 5586 * C29 - 5145 * C30 - 4704 * C31 - 4263 * C32 - 3822 * C33 - 3381 * C34 - 2940 * C35 - 2499 * C36 - 2058 * C37 - 1617 * C38 - 1176 * C39 - 735 * C40 - 420 * C41 - 210 * C42 - 84 * C43 - 21 * C44) / 361620
One way to write a formula for a 100-Period Hull Moving Average is:
(151000 * C + 283370 * C1 + 397463 * C2 + 493632 * C3 + 572230 * C4 + 633610 * C5 + 678125 * C6 + 706128 * C7 + 717972 * C8 + 714010 * C9 + 694595 * C10 + 675180 * C11 + 655765 * C12 + 636350 * C13 + 616935 * C14 + 597520 * C15 + 578105 * C16 + 558690 * C17 + 539275 * C18 + 519860 * C19 + 500445 * C20 + 481030 * C21 + 461615 * C22 + 442200 * C23 + 422785 * C24 + 403370 * C25 + 383955 * C26 + 364540 * C27 + 345125 * C28 + 325710 * C29 + 306295 * C30 + 286880 * C31 + 267465 * C32 + 248050 * C33 + 228635 * C34 + 209220 * C35 + 189805 * C36 + 170390 * C37 + 150975 * C38 + 131560 * C39 + 112145 * C40 + 92730 * C41 + 73315 * C42 + 53900 * C43 + 34485 * C44 + 15070 * C45 - 4345 * C46 - 23760 * C47 - 43175 * C48 - 62590 * C49 - 82005 * C50 - 97380 * C51 - 109119 * C52 - 117626 * C53 - 123305 * C54 - 126560 * C55 - 127795 * C56 - 127414 * C57 - 125821 * C58 - 123420 * C59 - 120615 * C60 - 117810 * C61 - 115005 * C62 - 112200 * C63 - 109395 * C64 - 106590 * C65 - 103785 * C66 - 100980 * C67 - 98175 * C68 - 95370 * C69 - 92565 * C70 - 89760 * C71 - 86955 * C72 - 84150 * C73 - 81345 * C74 - 78540 * C75 - 75735 * C76 - 72930 * C77 - 70125 * C78 - 67320 * C79 - 64515 * C80 - 61710 * C81 - 58905 * C82 - 56100 * C83 - 53295 * C84 - 50490 * C85 - 47685 * C86 - 44880 * C87 - 42075 * C88 - 39270 * C89 - 36465 * C90 - 33660 * C91 - 30855 * C92 - 28050 * C93 - 25245 * C94 - 22440 * C95 - 19635 * C96 - 16830 * C97 - 14025 * C98 - 11220 * C99 - 8415 * C100 - 6120 * C101 - 4284 * C102 - 2856 * C103 - 1785 * C104 - 1020 * C105 - 510 * C106 - 204 * C107 - 51 * C108) / 14165250
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
Thank you very much Bruce.
|
|
Registered User Joined: 12/30/2004 Posts: 11
|
My hard drive crashed soon after I got your formulae and I never got to test them till this week.
What I am finding from using the formulae you posted on Friday, May 14, 2010, 8:22:48 AM are that the same stocks are posted after the first day scan.
The same stocks would appear on the scan the second and third day and so forth.
I was expecting a new group of stocks for each day since I am looking for a turn up/down for that day only,
What am I doing wrong?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The formulas given in my Friday, May 14, 2010 1:54:51 PM ET post were in response to "Now I would like to have custom indicators for: 40 period HMA, 100 period HMA". They return the actual Value of the 40 and 100 Period HMA. They were not meant in any way to be Boolean (return True or False) or return a "group of stocks for each day since I am looking for a turn up/down for that day only" as no such request was made.
A formula for the current HMA40 being less than the previous HMA40 and the previous HMA40 being greater than the HMA40 from the Bar before that would be:
14640 * C + 11342 * C1 + 8187 * C2 + 5175 * C3 + 2306 * C4 + 277 * C25 + 441 * C26 + 441 * C27 + 441 * C28 + 441 * C29 + 441 * C30 + 441 * C31 + 441 * C32 + 441 * C33 + 441 * C34 + 441 * C35 + 441 * C36 + 441 * C37 + 441 * C38 + 441 * C39 + 441 * C40 + 315 * C41 + 210 * C42 + 126 * C43 + 63 * C44 + 21 * C45 < 420 * C5 + 3003 * C6 + 3003 * C7 + 3003 * C8 + 3003 * C9 + 3003 * C10 + 3003 * C11 + 3003 * C12 + 3003 * C13 + 3003 * C14 + 3003 * C15 + 3003 * C16 + 3003 * C17 + 3003 * C18 + 3003 * C19 + 3003 * C20 + 2019 * C21 + 1199 * C22 + 543 * C23 + 51 * C24 AND 14640 * C1 + 11342 * C2 + 8187 * C3 + 5175 * C4 + 2306 * C5 + 277 * C26 + 441 * C27 + 441 * C28 + 441 * C29 + 441 * C30 + 441 * C31 + 441 * C32 + 441 * C33 + 441 * C34 + 441 * C35 + 441 * C36 + 441 * C37 + 441 * C38 + 441 * C39 + 441 * C40 + 441 * C41 + 315 * C42 + 210 * C43 + 126 * C44 + 63 * C45 + 21 * C46 > 420 * C6 + 3003 * C7 + 3003 * C8 + 3003 * C9 + 3003 * C10 + 3003 * C11 + 3003 * C12 + 3003 * C13 + 3003 * C14 + 3003 * C15 + 3003 * C16 + 3003 * C17 + 3003 * C18 + 3003 * C19 + 3003 * C20 + 3003 * C21 + 2019 * C22 + 1199 * C23 + 543 * C24 + 51 * C25
A formula for the current HMA40 being greater than the previous HMA40 and the previous HMA40 being less than the HMA40 from the Bar before that would be:
14640 * C + 11342 * C1 + 8187 * C2 + 5175 * C3 + 2306 * C4 + 277 * C25 + 441 * C26 + 441 * C27 + 441 * C28 + 441 * C29 + 441 * C30 + 441 * C31 + 441 * C32 + 441 * C33 + 441 * C34 + 441 * C35 + 441 * C36 + 441 * C37 + 441 * C38 + 441 * C39 + 441 * C40 + 315 * C41 + 210 * C42 + 126 * C43 + 63 * C44 + 21 * C45 > 420 * C5 + 3003 * C6 + 3003 * C7 + 3003 * C8 + 3003 * C9 + 3003 * C10 + 3003 * C11 + 3003 * C12 + 3003 * C13 + 3003 * C14 + 3003 * C15 + 3003 * C16 + 3003 * C17 + 3003 * C18 + 3003 * C19 + 3003 * C20 + 2019 * C21 + 1199 * C22 + 543 * C23 + 51 * C24 AND 14640 * C1 + 11342 * C2 + 8187 * C3 + 5175 * C4 + 2306 * C5 + 277 * C26 + 441 * C27 + 441 * C28 + 441 * C29 + 441 * C30 + 441 * C31 + 441 * C32 + 441 * C33 + 441 * C34 + 441 * C35 + 441 * C36 + 441 * C37 + 441 * C38 + 441 * C39 + 441 * C40 + 441 * C41 + 315 * C42 + 210 * C43 + 126 * C44 + 63 * C45 + 21 * C46 < 420 * C6 + 3003 * C7 + 3003 * C8 + 3003 * C9 + 3003 * C10 + 3003 * C11 + 3003 * C12 + 3003 * C13 + 3003 * C14 + 3003 * C15 + 3003 * C16 + 3003 * C17 + 3003 * C18 + 3003 * C19 + 3003 * C20 + 3003 * C21 + 2019 * C22 + 1199 * C23 + 543 * C24 + 51 * C25
A formula for the current HMA100 being less than the previous HMA100 and the previous HMA100 being greater than the HMA100 from the Bar before that would be:
403370 * C + 381 * C32 + 1593 * C33 + 2401 * C34 + 2805 * C35 + 2805 * C36 + 2805 * C37 + 2805 * C38 + 2805 * C39 + 2805 * C40 + 2805 * C41 + 2805 * C42 + 2805 * C43 + 2805 * C44 + 2805 * C45 + 2805 * C46 + 2805 * C47 + 2805 * C48 + 2805 * C49 + 2805 * C50 + 2805 * C51 + 2805 * C52 + 2805 * C53 + 2805 * C54 + 2805 * C55 + 2805 * C56 + 2805 * C57 + 2805 * C58 + 2805 * C59 + 2805 * C60 + 2805 * C61 + 2805 * C62 + 2805 * C63 + 2805 * C64 + 2805 * C65 + 2805 * C66 + 2805 * C67 + 2805 * C68 + 2805 * C69 + 2805 * C70 + 2805 * C71 + 2805 * C72 + 2805 * C73 + 2805 * C74 + 2805 * C75 + 2295 * C76 + 1836 * C77 + 1428 * C78 + 1071 * C79 + 765 * C80 + 510 * C81 + 306 * C82 + 153 * C83 + 51 * C84 < 19415 * C1 + 19415 * C2 + 19415 * C3 + 19415 * C4 + 19415 * C5 + 19415 * C6 + 19415 * C7 + 19415 * C8 + 19415 * C9 + 19415 * C10 + 19415 * C11 + 19415 * C12 + 19415 * C13 + 19415 * C14 + 19415 * C15 + 19415 * C16 + 19415 * C17 + 19415 * C18 + 19415 * C19 + 19415 * C20 + 19415 * C21 + 19415 * C22 + 19415 * C23 + 19415 * C24 + 19415 * C25 + 15375 * C26 + 11739 * C27 + 8507 * C28 + 5679 * C29 + 3255 * C30 + 1235 * C31 AND 403370 * C1 + 381 * C33 + 1593 * C34 + 2401 * C35 + 2805 * C36 + 2805 * C37 + 2805 * C38 + 2805 * C39 + 2805 * C40 + 2805 * C41 + 2805 * C42 + 2805 * C43 + 2805 * C44 + 2805 * C45 + 2805 * C46 + 2805 * C47 + 2805 * C48 + 2805 * C49 + 2805 * C50 + 2805 * C51 + 2805 * C52 + 2805 * C53 + 2805 * C54 + 2805 * C55 + 2805 * C56 + 2805 * C57 + 2805 * C58 + 2805 * C59 + 2805 * C60 + 2805 * C61 + 2805 * C62 + 2805 * C63 + 2805 * C64 + 2805 * C65 + 2805 * C66 + 2805 * C67 + 2805 * C68 + 2805 * C69 + 2805 * C70 + 2805 * C71 + 2805 * C72 + 2805 * C73 + 2805 * C74 + 2805 * C75 + 2805 * C76 + 2295 * C77 + 1836 * C78 + 1428 * C79 + 1071 * C80 + 765 * C81 + 510 * C82 + 306 * C83 + 153 * C84 + 51 * C85 > 19415 * C2 + 19415 * C3 + 19415 * C4 + 19415 * C5 + 19415 * C6 + 19415 * C7 + 19415 * C8 + 19415 * C9 + 19415 * C10 + 19415 * C11 + 19415 * C12 + 19415 * C13 + 19415 * C14 + 19415 * C15 + 19415 * C16 + 19415 * C17 + 19415 * C18 + 19415 * C19 + 19415 * C20 + 19415 * C21 + 19415 * C22 + 19415 * C23 + 19415 * C24 + 19415 * C25 + 19415 * C26 + 15375 * C27 + 11739 * C28 + 8507 * C29 + 5679 * C30 + 3255 * C31 + 1235 * C32
A formula for the current HMA100 being greater than the previous HMA100 and the previous HMA100 being less than the HMA100 from the Bar before that would be:
403370 * C + 381 * C32 + 1593 * C33 + 2401 * C34 + 2805 * C35 + 2805 * C36 + 2805 * C37 + 2805 * C38 + 2805 * C39 + 2805 * C40 + 2805 * C41 + 2805 * C42 + 2805 * C43 + 2805 * C44 + 2805 * C45 + 2805 * C46 + 2805 * C47 + 2805 * C48 + 2805 * C49 + 2805 * C50 + 2805 * C51 + 2805 * C52 + 2805 * C53 + 2805 * C54 + 2805 * C55 + 2805 * C56 + 2805 * C57 + 2805 * C58 + 2805 * C59 + 2805 * C60 + 2805 * C61 + 2805 * C62 + 2805 * C63 + 2805 * C64 + 2805 * C65 + 2805 * C66 + 2805 * C67 + 2805 * C68 + 2805 * C69 + 2805 * C70 + 2805 * C71 + 2805 * C72 + 2805 * C73 + 2805 * C74 + 2805 * C75 + 2295 * C76 + 1836 * C77 + 1428 * C78 + 1071 * C79 + 765 * C80 + 510 * C81 + 306 * C82 + 153 * C83 + 51 * C84 > 19415 * C1 + 19415 * C2 + 19415 * C3 + 19415 * C4 + 19415 * C5 + 19415 * C6 + 19415 * C7 + 19415 * C8 + 19415 * C9 + 19415 * C10 + 19415 * C11 + 19415 * C12 + 19415 * C13 + 19415 * C14 + 19415 * C15 + 19415 * C16 + 19415 * C17 + 19415 * C18 + 19415 * C19 + 19415 * C20 + 19415 * C21 + 19415 * C22 + 19415 * C23 + 19415 * C24 + 19415 * C25 + 15375 * C26 + 11739 * C27 + 8507 * C28 + 5679 * C29 + 3255 * C30 + 1235 * C31 AND 403370 * C1 + 381 * C33 + 1593 * C34 + 2401 * C35 + 2805 * C36 + 2805 * C37 + 2805 * C38 + 2805 * C39 + 2805 * C40 + 2805 * C41 + 2805 * C42 + 2805 * C43 + 2805 * C44 + 2805 * C45 + 2805 * C46 + 2805 * C47 + 2805 * C48 + 2805 * C49 + 2805 * C50 + 2805 * C51 + 2805 * C52 + 2805 * C53 + 2805 * C54 + 2805 * C55 + 2805 * C56 + 2805 * C57 + 2805 * C58 + 2805 * C59 + 2805 * C60 + 2805 * C61 + 2805 * C62 + 2805 * C63 + 2805 * C64 + 2805 * C65 + 2805 * C66 + 2805 * C67 + 2805 * C68 + 2805 * C69 + 2805 * C70 + 2805 * C71 + 2805 * C72 + 2805 * C73 + 2805 * C74 + 2805 * C75 + 2805 * C76 + 2295 * C77 + 1836 * C78 + 1428 * C79 + 1071 * C80 + 765 * C81 + 510 * C82 + 306 * C83 + 153 * C84 + 51 * C85 < 19415 * C2 + 19415 * C3 + 19415 * C4 + 19415 * C5 + 19415 * C6 + 19415 * C7 + 19415 * C8 + 19415 * C9 + 19415 * C10 + 19415 * C11 + 19415 * C12 + 19415 * C13 + 19415 * C14 + 19415 * C15 + 19415 * C16 + 19415 * C17 + 19415 * C18 + 19415 * C19 + 19415 * C20 + 19415 * C21 + 19415 * C22 + 19415 * C23 + 19415 * C24 + 19415 * C25 + 19415 * C26 + 15375 * C27 + 11739 * C28 + 8507 * C29 + 5679 * C30 + 3255 * C31 + 1235 * C32
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/30/2010 Posts: 3
|
[QUOTE=Bruce_L]Welcome to the forums. A very good foundation for learning how to use TeleChart can be gained by reviewing the following:
If you are new to TeleChart READ THIS FIRST!
One way to write a formula for a 20-Period Hull Moving Average is:
124 * C / 1155 + 92 * C1 / 525 + 4777 * C2 / 23100 + 79 * C3 / 385 + 401 * C4 / 2310 + 164 * C5 / 1155 + 17 * C6 / 154 + 13 * C7 / 165 + 109 * C8 / 2310 + 6 * C9 / 385 - 37 * C10 / 2310 - 191 * C11 / 5775 - 151 * C12 / 3850 - 4 * C13 / 105 - C14 / 30 - C15 / 35 - C16 / 42 - 2 * C17 / 105 - C18 / 70 - C19 / 105 - C20 / 210 - C21 / 525 - C22 / 2100
Bruce, I'm confused as to why there are 23 (c to c22) daily periods in the formula for a 20-period HMA. Although I've researched the HMA formula, I don't understand how you structured this PCF - I was expecting perhaps some parentheses to simplfy it into the various math operations. I need a PCF for a 55-day HMA, Can you show how it should be structured? If it would be earier to just provide it, that would be fine also. You do a great job helping all of us with these PCFs! Thanks! PS - I suspect the Hull MA will become more popular - perhaps it could be added to the standard indicators for TC200 with a parameter for setting the desired period. Possible, or no because of the code language?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The Hull Moving Average topic which is the first reference at the bottom of the very post you quoted goes into the calculations of the Hull Moving Average. In the case of the 20-Period Hull Moving Average, it is the 4-Period Front Weighted Moving Average of the difference between two times the 10-Period Front Weighted Moving Average of Price and the 20-Period Front Weighted Moving Average of Price. So something like (this is not valid syntax and cannot be used in TC2000 PCF):
FWAVG(2 * FWAVG10 - FWAVG20, 4)
The three extra terms are the result of the 4-Period Front Weighted Moving Average being applied to the 20-Period Front Weighted Moving Average.
So a 55-Period Hull Moving Average would be (again, the syntax is not valid):
FWAVG(2 * FWAVG27 - FWAVG55, 7)
Which can be expressed using valid syntax with the following Indicator Formula:
(31185 * C + 56564 * C1 + 76330 * C2 + 90676 * C3 + 99795 * C4 + 103880 * C5 + 103124 * C6 + 97720 * C7 + 92316 * C8 + 86912 * C9 + 81508 * C10 + 76104 * C11 + 70700 * C12 + 65296 * C13 + 59892 * C14 + 54488 * C15 + 49084 * C16 + 43680 * C17 + 38276 * C18 + 32872 * C19 + 27468 * C20 + 22064 * C21 + 16660 * C22 + 11256 * C23 + 5852 * C24 + 448 * C25 - 4956 * C26 - 10360 * C27 - 14224 * C28 - 16768 * C29 - 18212 * C30 - 18776 * C31 - 18680 * C32 - 18144 * C33 - 17388 * C34 - 16632 * C35 - 15876 * C36 - 15120 * C37 - 14364 * C38 - 13608 * C39 - 12852 * C40 - 12096 * C41 - 11340 * C42 - 10584 * C43 - 9828 * C44 - 9072 * C45 - 8316 * C46 - 7560 * C47 - 6804 * C48 - 6048 * C49 - 5292 * C50 - 4536 * C51 - 3780 * C52 - 3024 * C53 - 2268 * C54 - 1512 * C55 - 945 * C56 - 540 * C57 - 270 * C58 - 108 * C59 - 27 * C60) / 1164240
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 7/25/2006 Posts: 31
|
Bruce - could you provide a more generic formula for the Hull Moving Average - something on the order of X * C + Y * C1...... and what x, y, etc. consist of. I'm looking at entering PCFs for HULL MAs of different time frames than you've listed (9, 20, 40, 100, etc) and unfortunately haven't been able to figure out how the numbers for each are calculated.
I would also like to add a suggestion - please add the Hull Moving Average as a PCF so that all we have to do is call it and enter a number of periods, etc.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The Hull Moving Average topic explores the calculations. I cannot think of a way to create a generic X * C + Y * C1.... type formula for this. You have to actually do the calcualtions to get the values of X, Y, etc....
Thank you for your suggestion.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
Id like a 70 perod Hull Mav.
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
One way to create an Indicator Formula for a 70-period Hull moving average is:
(14840 * C + 27329 * C1 + 37529 * C2 + 45502 * C3 + 51310 * C4 + 55015 * C5 + 56679 * C6 + 56364 * C7 + 54132 * C8 + 51900 * C9 + 49668 * C10 + 47436 * C11 + 45204 * C12 + 42972 * C13 + 40740 * C14 + 38508 * C15 + 36276 * C16 + 34044 * C17 + 31812 * C18 + 29580 * C19 + 27348 * C20 + 25116 * C21 + 22884 * C22 + 20652 * C23 + 18420 * C24 + 16188 * C25 + 13956 * C26 + 11724 * C27 + 9492 * C28 + 7260 * C29 + 5028 * C30 + 2796 * C31 + 564 * C32 - 1668 * C33 - 3900 * C34 - 6132 * C35 - 7796 * C36 - 8963 * C37 - 9704 * C38 - 10090 * C39 - 10192 * C40 - 10081 * C41 - 9828 * C42 - 9504 * C43 - 9180 * C44 - 8856 * C45 - 8532 * C46 - 8208 * C47 - 7884 * C48 - 7560 * C49 - 7236 * C50 - 6912 * C51 - 6588 * C52 - 6264 * C53 - 5940 * C54 - 5616 * C55 - 5292 * C56 - 4968 * C57 - 4644 * C58 - 4320 * C59 - 3996 * C60 - 3672 * C61 - 3348 * C62 - 3024 * C63 - 2700 * C64 - 2376 * C65 - 2052 * C66 - 1728 * C67 - 1404 * C68 - 1080 * C69 - 756 * C70 - 504 * C71 - 315 * C72 - 180 * C73 - 90 * C74 - 36 * C75 - 9 * C76) / 805140
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/5/2012 Posts: 1
|
I second that. Please include the Hull moving average in the default list of indicators.
QUOTE (DavMcKin)
I would also like to add a suggestion - please add the Hull Moving Average as a PCF so that all we have to do is call it and enter a number of periods, etc.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Thank you for your suggestion.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 7/25/2006 Posts: 31
|
Bruce,
Do you have an excel spreadsheet to calculate Hull Moving Average? If so, would there be anyway that I (we) could get a copy of it?
Also, please add Hull MA to the list of indicators for the program.
Thanks.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Thank you for your suggestion.
I kind of have a spreadsheet for this, but it happens to be the least user friendly spreadsheet in my arsenal and it definitely isn't worth sharing. Changing the period involves a lot of manual work.
It actually has a different sheet for every period I have constructed so far. When I need a new period, I copy an existing sheet which has a square root of the period which is the same or as close as possible to the new period. I then manually add columns and rows and adjust formulas to construct the new sheet. I normally need a few tries to get the denominator right.
Even then, the spreadsheet only gives me what I need at a minimum to create the formula. Once I have copied and pasted the results into a text editor, I still need to add some formatting and replace the + -x sections of the formula with - x instead.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/11/2014 Posts: 3
|
Bruce, the real power of the Hull Moving Average is in the Up and Down color changes. I noticed the indicator you created below does not have that feature, can that be programmed in. I had this indicator from Tradestation for years but now I"m on TC2000 and I don't know how to program the color changes.. Please advise.
|
|
Registered User Joined: 6/11/2014 Posts: 3
|
This is how we programmed the up/down color in Tradestation, can this be done in TC2000?
if (Value1 > Value1[1]) then begin
SetPlotColor[colourDeltaBar](1, upColour);
end;
if (Value1 < Value1[1]) then begin
SetPlotColor[colourDeltaBar](1, downColour);
end;
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It is not possible to paint either the Hull Moving Average or price in TC2000 based on if the net change in the Hull Moving Average is positive or negative.
You could add a Rate of Change indicator (it doesn't matter if it is % or not) to the chart and change the Data Source to the Hull Moving Average. If the period of the ROC indicator is set to 1 and the Plot Style is set to Histogram, then you could have the Rate of Change indicator have different colors depending on if it is above or below zero, but there is no way to then apply those colors to another indicator.
Change Data Source (3:38)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/11/2014 Posts: 3
|
Got it, thanks Bruce, that kind of works....
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Unfortunately, "kind of works" was the best I could figure out in this case.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
QUOTE (Bruce_L)
Unfortunately, "kind of works" was the best I could figure out in this case.
Bruce
Is the size of the PCFs stopping you from using the form
ABS(HULL>HULL.1)*HULL
ABS(HULL<HULL.1)*HULL
with green and red dots for example?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Not really, I just never think of plotting moving averages as dots and it can't be done with the line Plot Style. So I didn't suggest it because of personal bias more than anything else.
I use colored dots for things like conditions which happen intermittently (and I like the technique a lot). But I find dots for continuous things that are constantly plotted on the chart a bit annoying when zooming in and out because the size of the dots is fixed while the size of the price bars changes. When I get it to look right in one zoom, it generally looks horrible in other zooms.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (winthorpe) Hull Moving Average PCF's for following: HMA 3 HMA 5 HMA8 HMA13 HMA16
Can you please help me with PCF's for the above mentioned.
I did find your HMA20 :
One way to write a formula for Price crossing up through its 20-Period HMA would be:
C > 124 * C / 1155 + 92 * C1 / 525 + 4777 * C2 / 23100 + 79 * C3 / 385 + 401 * C4 / 2310 + 164 * C5 / 1155 + 17 * C6 / 154 + 13 * C7 / 165 + 109 * C8 / 2310 + 6 * C9 / 385 - 37 * C10 / 2310 - 191 * C11 / 5775 - 151 * C12 / 3850 - 4 * C13 / 105 - C14 / 30 - C15 / 35 - C16 / 42 - 2 * C17 / 105 - C18 / 70 - C19 / 105 - C20 / 210 - C21 / 525 - C22 / 2100 AND C1 <= 124 * C1 / 1155 + 92 * C2 / 525 + 4777 * C3 / 23100 + 79 * C4 / 385 + 401 * C5 / 2310 + 164 * C6 / 1155 + 17 * C7 / 154 + 13 * C8 / 165 + 109 * C9 / 2310 + 6 * C10 / 385 - 37 * C11 / 2310 - 191 * C12 / 5775 - 151 * C13 / 3850 - 4 * C14 / 105 - C15 / 30 - C16 / 35 - C17 / 42 - 2 * C18 / 105 - C19 / 70 - C20 / 105 - C21 / 210 - C22 / 525 - C23 / 2100
(you wrote for someone 5/10/2010)
but, I could not figure out how the syntax to do one for:
HMA 3 HMA 5 HMA8 HMA13 HMA16
3-Period Hull Moving Average:
(9 * C - 2 * C1 - C2) / 6
5-Period Hull Moving Average:
(30 * C + 27 * C1 - 7 * C3 - 4 * C4 - C5) / 45
8- Period Hull Moving Average:
(208 * C + 250 * C1 + 157 * C2 + 64 * C3 - 29 * C4 - 50 * C5 - 35 * C6 - 20 * C7 - 5 * C8) / 540
13-Period Hull Moving Average:
(351 * C + 516 * C1 + 518 * C2 + 380 * C3 + 242 * C4 + 104 * C5 - 34 * C6 - 94 * C7 - 102 * C8 - 84 * C9 - 66 * C10 - 48 * C11 - 30 * C12 - 12 * C13 - 3 * C14) / 1638
16-Period Hull Moving Average:
(1600 * C + 2564 * C1 + 2951 * C2 + 2820 * C3 + 2230 * C4 + 1640 * C5 + 1050 * C6 + 460 * C7 - 130 * C8 - 448 * C9 - 562 * C10 - 540 * C11 - 450 * C12 - 360 * C13 - 270 * C14 - 180 * C15 - 90 * C16 - 36 * C17 - 9 * C18) / 12240
QUOTE (winthorpe) Is it possible to script the ability to color these various HMA's so that I can differentiate one from another?
If you are going to plot these on the chart, you will add Custom PCF Indicators. Each Custom PCF Indicator will have its own color setting which can be adjusted so you can tell the moving averages apart.
Adding and Moving Indicators (7:19)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/23/2006 Posts: 54
|
Can you please help me with the following PCFs:
Hull Moving Average:
(1) for HMA8 "crossing above" HMA13 on the daily time frame
(2) for HMA8 "crossing below"HMA13 on the daily time frame
(3) an example of conditonal PCF of HMA3 "being above" HMA8 on daily time frame
Can one readiy change the time frames of the above daily time frame PCFs
|
|
Registered User Joined: 6/23/2006 Posts: 54
|
Where can I find the PCF reference guide to learn more about writing PCFs?
Is there a .pdf PCF reference guide that one can download?
|
|
Guest-1 |