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 |

Hull versus X Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
0002ct
Posted : Tuesday, June 26, 2018 9:24:55 AM
Registered User
Joined: 11/19/2015
Posts: 459

Hello.

In looking at the underlying calculations for each, I'm wondering what the difference is between the Hull MA and something like a multple linear regression line where the ending values would plot the line.

So, for example, how would Hull8 differ from an 8-day multipole linear regression trendline / least-squares moving average?

Thank you very much.

0002ct
Posted : Tuesday, June 26, 2018 9:25:26 AM
Registered User
Joined: 11/19/2015
Posts: 459

*multiple. 
 

Al_Gorithm
Posted : Tuesday, June 26, 2018 9:34:13 AM

Registered User
Joined: 6/30/2017
Posts: 1,227

I'm not a math geek or a CMT, but in my experience they're close. Try plotting both on your chart and have a look, until Bruce comes along with the explanation. :)

0002ct
Posted : Tuesday, June 26, 2018 10:04:30 AM
Registered User
Joined: 11/19/2015
Posts: 459

ALG, indeed, you're right. They plot similarly. 

Bruce, no need to reply yet unless you feel like edifying to userverse on the exact difference. I might come back at some point to ask about related formulas.

Thanks, all!

Bruce_L
Posted : Tuesday, June 26, 2018 10:32:17 AM


Worden Trainer

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

Both moving averages try to minimize lag in slightly different ways.

The moving linear regression is well, more linear than the Hull moving average in its calculations.

Let's take a look at the factors when the same denominator is used for 10 period versions of a moving linear regression.

(342 * C + 288 * C1 + 234 * C2 + 180 * C3 + 126 * C4 + 72 * C5 + 18 * C6 - 36 * C7 - 90 * C8 - 144 * C9) / 990

And a Hull moving average. 

(240 * C + 343 * C1 + 328 * C2 + 214 * C3 + 100 * C4 - 14 * C5 - 62 * C6 - 66 * C7 - 48 * C8 - 30 * C9 - 12 * C10 - 3 * C11) / 990

Note the moving linear regression has the greatest weight on the most recent bar. The weight at each bar is decreased by the same amount as you move back (-54 / 990).

The Hull moving average actually has the greatest weight on one bar back instead of the current bar. The difference in weight between each bar also changes as you go back. Because you are taking the front weight moving average of (twice one front weighted moving average minus another front weighted moving average), it also includes data for 12 bars instead of just 10 like the MLR.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Tuesday, June 26, 2018 11:40:50 AM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, this is very helpful. You've probably heard that from me before. Thank you very much.

0002ct
Posted : Wednesday, June 27, 2018 10:27:04 AM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, when you have a moment, would you please help me with a Red-Blue, Blue-Red plot for Moving Linear Regression 8-bar. This would be the same as the example below, but for mLR...

 IIF(HAVGC8 > HAVGC8.1, HAVGC8, 1 / 0)

 IIF(HAVGC8 < HAVGC8.1, HAVGC8, 1 / 0)

I'm asking because I don't know if there is built-in functions for this (preferred for now) or the calcuations must be constructed, as you showed me before. 

Thank you very much.

0002ct
Posted : Wednesday, June 27, 2018 10:28:07 AM
Registered User
Joined: 11/19/2015
Posts: 459

My typing is atrocious. I know how to make nouns and verbs agree. I defend my poorly executed english because obviously my math is worse.

Bruce_L
Posted : Wednesday, June 27, 2018 10:42:28 AM


Worden Trainer

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

Going Up:

IIF(3 * FAVGC8 - 2 * AVGC8 > 3 * FAVGC8.1 - 2 * AVGC8.1, 3 * FAVGC8 - 2 * AVGC8, 1 / 0)

Going Down:

IIF(3 * FAVGC8 - 2 * AVGC8 < 3 * FAVGC8.1 - 2 * AVGC8.1, 3 * FAVGC8 - 2 * AVGC8, 1 / 0)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Wednesday, June 27, 2018 10:51:17 AM
Registered User
Joined: 11/19/2015
Posts: 459

Thank you, Bruce. 

0002ct
Posted : Friday, June 29, 2018 1:48:37 PM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, would you kindly help me with "moving linear regression line price at next bar" in the same was that you solved for Hull (e.g. (51 * C1 + 186 * (C2 + C3) + 78 * C4 + 6 * C5 - 115 * C - 30 * (C6 + C7) - 15 * C8 - 5 * C9) / 312)?

Many thanks.

Bruce_L
Posted : Friday, June 29, 2018 2:06:15 PM


Worden Trainer

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

What is the period of the moving linear regression of interest?



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Friday, June 29, 2018 2:19:42 PM
Registered User
Joined: 11/19/2015
Posts: 459

6, please. Thanks for remembering that typically start with 8 but in this case would like to use 6.

Bruce_L
Posted : Friday, June 29, 2018 2:38:35 PM


Worden Trainer

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

The current MLR6 should equal the previous MLR6 during the current bar when the price is:

(15 * AVGC5.1 - 4 * C6) / 11

The next MLR6 should match the current MLR6 during the next bar if the current bar closes at the current price when the price is:

(15 * AVGC5 - 4 * C5) / 11



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Friday, June 29, 2018 3:34:26 PM
Registered User
Joined: 11/19/2015
Posts: 459

Thank you, Bruce. I very much appreciate it. Enjoy your weekend.

0002ct
Posted : Tuesday, July 3, 2018 10:22:27 AM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, hello. Would it be possible to get the formula for: "current close is within .7%^ of the 'next price change at" formulas for both the Hull and mLR formulas?

So this would be .7% proximity regardless of whether the current price is above or below the "next price change" indicator (absolute).

Thank you very much.

0002ct
Posted : Tuesday, July 3, 2018 10:23:25 AM
Registered User
Joined: 11/19/2015
Posts: 459

Ignore the carat above. I spilled coffee on my keyboard and it doesn't work.

Bruce_L
Posted : Thursday, July 5, 2018 11:06:58 AM


Worden Trainer

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

Please try the following for Hull.

100 * ABS(C / ((51 * C1 + 186 * (C2 + C3) + 78 * C4 + 6 * C5 - 115 * C - 30 * (C6 + C7) - 15 * C8 - 5 * C9) / 312) - 1) <= .7

And the following for MLR.

100 * ABS(C / ((15 * AVGC5 - 4 * C5) / 11) - 1) <= .7



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Thursday, July 5, 2018 11:14:06 AM
Registered User
Joined: 11/19/2015
Posts: 459

Hi, Bruce. Thank you very much. These are perfect.
Much appreciated.

0002ct
Posted : Friday, July 6, 2018 10:04:56 AM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, hello.
I'm getting an unexpected result for the "hull8 would change at next bar" formula. Currently, the Hull8 price is "red" on a daily chart, but the "next price @" formula is returning a projected (blue) price change at a *lower* price than current. I would expect this to be higher. Should I share this tab over email to you? Why would this be happening?

https://imgur.com/a/QaS4RzA

Bruce_L
Posted : Friday, July 6, 2018 10:30:01 AM


Worden Trainer

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

ou are looking at UGAZ in a daily time frame, right?

On my charts, the 8 period Hull moving average is currently 58.81 and the value at which it would change to blue is 61.40 (which is above the moving average).

Note that you might want to try putting the two indicators in that pane on the same scale. Click on one of them and choose Scaling.... Then change Scale With to the other indicator in the pane.

Also note that the 66.73 value is the value of the most recent blue dot because I am assuming it is the first indicator in the scale. If you want to have that value always be the value of the 8 period Hull moving average, add the following Custom PCF Indicator as the first (far left) indicator in the scale.

HAVGC8



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Friday, July 6, 2018 10:59:17 AM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, Yes, it was UGAZ. I got it sorted out. I had been messing around with shuffling panes around and simply forgot what component was tied to what souce.

Thank you for the note about scaling. I'm usually uncertain about whether to scale something by itself or to another indicator. I think this is what I had asked about before, that the visual position changes on scaling. I need the value outputted, however, so I choose "by itself" for the "next price @" horizontal lines so that I can see the value even if the line's position isn't accurate. 

Thanks again, Bruce. Have a great weekend.

Bruce_L
Posted : Friday, July 6, 2018 11:07:19 AM


Worden Trainer

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

You could plot it twice in the pane, once in the same scale as the other indicators to get the a plot in the correct scale and a second time in its own scale to get the number in the scale.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Friday, July 6, 2018 11:39:02 AM
Registered User
Joined: 11/19/2015
Posts: 459

Ah, yes. Just did that, named one "price" (scaled to itself) and the other "cross spot". Thanks again, Bruce. I really appreciate it.

0002ct
Posted : Tuesday, July 10, 2018 2:35:58 PM
Registered User
Joined: 11/19/2015
Posts: 459

Hello.

Bruce, would it be possible to get the "next Heiken price at" formula? For reference, the red-green formula I have been using is
O + H + L + C >= O1 + H1 + L1 + C1 AND O1 + H1 + L1 + C1 < O2 + H2 + L2 + C2

and the g-r one has been:
O + H + L + C < O1 + H1 + L1 + C1 AND O1 + H1 + L1 + C1 >= O2 + H2 + L2 + C2

Thank you very much.

Bruce_L
Posted : Tuesday, July 10, 2018 2:53:40 PM


Worden Trainer

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

I really don't think it is possible in the general spirit of the question as at relates to previous responses.

You would solve for C, so the HA close of the current bar will equal the HA close of the previous bar when the price equals the following.

O1 + H1 + L1 + C1 - O - H - L

But you can't really do this for the next bar because you can't subtract one from the bars ago parameters for the last three terms (because the bars ago parameters would be negative one). About the best you could do is the following.

O + H + L + C

But this would only be true if H = L for the next bar. Otherwise you would need to start using the first formula once the next bar starts forming and H > L.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Tuesday, July 10, 2018 3:33:00 PM
Registered User
Joined: 11/19/2015
Posts: 459

Thank you very much. The explanation helps. Much appreciated. 

0002ct
Posted : Wednesday, July 11, 2018 10:07:58 AM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, could you kindly remind me why on rare occasions I would see a "next mLR price at" that would be lower than the current price when the trend condition is still down? I would expect to see a nice-price change at a price above current price. Happy to send my layout if it's easier. This is showing on UVXY.

 https://imgur.com/a/v7OsQpW

0002ct
Posted : Wednesday, July 11, 2018 10:12:16 AM
Registered User
Joined: 11/19/2015
Posts: 459

nice. sure.
*next

Bruce_L
Posted : Wednesday, July 11, 2018 10:50:12 AM


Worden Trainer

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

You may want to review the posts in this topic starting at Friday, July 06, 2018 10:04:56 AM ET.

That said, it is actually possible for this to be the case in reality and not just a scaling issue. Let's use an 8-period Hull moving average as an example.

(312 * C + 427 * C1 + 376 * C2 + 190 * C3 + 4 * C4 - 74 * C5 - 80 * C6 - 50 * C7 - 20 * C8 - 5 * C9) / 1080

Note that 2nd and 3rd terms have larger contributions to the value of the moving average than the current price. Also note that five of the terms actually provide a negative contribution to the current value of HAVGC8.

The net change in HAVGC8 has similar characteristics.

(312 * C + 115 * C1 - 51 * C2 - 186 * (C3 + C4) - 78 * C5 - 6 * C6 + 30 * (C7 + C8) + 15 * C9 + 5 * C10) / 1080

While the current price is the largest individual single price compnoent, there are six past prices which contribute positively toward the net change in the moving average and five past terms which conribute negatively towar the net change in the moving average.

Contrast this with a simple moving average where the only positive term would be the current price and the only negative term would be the price of period bars ago or an exponential moving average where the only positive term would be the current price (an EMA always moves in the direction of price).

So let us then consider a slightly re-arranged version of at what price the value of the next HAVGC8 would equal the current value (assuming the current price doesn't change).

(-115 * C + 51 * C1 + 186 * (C2 + C3) + 78 * C4 + 6 * C5 - 30 * (C6 + C7) - 15 * C8 - 5 * C9) / 312

The really interesting parts of this are that the greatest contribution to this value is 2 and 3 bars ago and that the current price actually contributes negatively toward the price at which HAVGC8 will change directions. It is a very strange quirk of the way Hull moving averages are calculated.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Wednesday, July 11, 2018 1:00:58 PM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, I need a moment to absorb this very useful post. Thank you very much for working through the idea. I'll take some time to get the ideas aligned. Thank you, again.

0002ct
Posted : Wednesday, July 11, 2018 2:13:55 PM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, to confirm, I do know it's not a scaling issue as before. I got that ironed out with the correct scaling and corrected expectation of the alignment. 

The quirk you mention -- I wonder if it relates to why I only see this "next change is still lower" event only on UVXY and VIX-X, but w/r/t the latter, not VVIX. Is it that the evaluation periods are too long for the price return distribution? 

a. What could be happening with the former two that isn't happening with, say, VVIX?

b. When the price-at value is lower like this, what is it saying, in pseudo?

Thank you again. 

 

Bruce_L
Posted : Wednesday, July 11, 2018 2:40:57 PM


Worden Trainer

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

I have tried to explain the math of why it happens, but I can't really give you any sort of interpration advice about what it means.

If the concern is that the math is wrong, you can verify the math by using the formula for the current bar instead of the next bar (just add one to all of the bars ago parameters).

(-115 * C1 + 51 * C2 + 186 * (C3 + C4) + 78 * C5 + 6 * C6 - 30 * (C7 + C8) - 15 * C9 - 5 * C10) / 312

The 8 period Hull moving average will be flat when C is the same as the above formula and nearly flat compared to the previous bar when price is very close to this value.

Maybe bustermu's comments in the following topics will be more enlightening when trying to examine the construction and interpration of different types of low lag moving averages.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Wednesday, July 11, 2018 2:59:28 PM
Registered User
Joined: 11/19/2015
Posts: 459

No, I do not have a concern about the math, to say the least. I'm grateful for the explanations and understand about interpretation. I'll continue to review. Thank you again for everything, Bruce. 

Bruce_L
Posted : Wednesday, July 11, 2018 3:20:11 PM


Worden Trainer

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

Another reason to plot the formula for the current version in the same pane and scale as price might be to see how it behaves. This could inform you somewhat as to the anticipated behavior of the next bar version.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Thursday, July 12, 2018 1:43:35 PM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, I just got a moment now to reply after being in and out. Thank you for revisiting the idea and addressing my questions.

I have added the "current" version (the most recent formula from you above) and added it to the pane.  I think this version seems more responsive to suggesting a level for the next price change and I think having both actually does help interpret a specific condition.

Would I need only to add 1 to the mLR formula to generate the same? 

I'll review bustermu's links as suggested. I remember seeing them before and I'll refresh.

My sincere thanks for everything. You are a giant asset to this service.
 

Bruce_L
Posted : Thursday, July 12, 2018 2:08:25 PM


Worden Trainer

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

Assuming you have a "next bar" version, adding one to all of the bars ago parameters will give you the "current bar" version.

If you have the "current bar" version, subtracting one from all of the bars ago parameters will give you the "next bar" version.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Thursday, July 12, 2018 2:34:28 PM
Registered User
Joined: 11/19/2015
Posts: 459

Yes, perfect. Thank you so much, Bruce.

Bruce_L
Posted : Thursday, July 12, 2018 2:39:51 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.