3 versions of the Hull Average
Forums › ProRealTime English forum › ProOrder support › 3 versions of the Hull Average
- This topic has 18 replies, 5 voices, and was last updated 3 years ago by robertogozzi.
-
-
01/18/2021 at 7:16 PM #158362
For the past year, before v11, I have been using this hard coded version of the Hull average:
123Period = 20inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)HULL = weightedaverage[round(sqrt(Period))](inner)Now that it is built in to v11, it can be written as
1HullAverage[20](typicalPrice)or
1average[20,8](typicalprice)As someone who uses this MA a lot, this should simplify my life. Except that they all give different results. The first image is the hard code, the second is hullaverage [20](typicalprice) and the third is average [20,8](typicalprice).
I chose this algo for testing as it uses 3 instances of this MA. I would not conclude that the hard coded version (which was written by Vonasi, btw), is the ‘best’ — it probably gives the best result because the whole algo was designed around it. I’m only posting this to show that the 3 are not interchangeable. I was especially surprised to see such a difference between the 2 built-in versions, you’d really think they should be the same.
If anyone’s interested, this is the original formula from Alan Hull’s website:
Integer(SquareRoot(Period)) WMA [2 x Integer(Period/2) WMA(Price) – Period WMA(Price)]
4 users thanked author for this post.
01/18/2021 at 7:29 PM #158369Have you created an indicator to compare them all directly? My platform is closed at the moment so I can’t test.
123456789Period = 20inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)HULL1 = weightedaverage[round(sqrt(Period))](inner)HULL2 = HullAverage[20](typicalprice)HULL3 = average[20,8](typicalprice)return Hull1, hull2, hull31 user thanked author for this post.
01/18/2021 at 7:47 PM #158372I made copies of the algo. The first one has
12345Period= 170inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)HULLa = weightedaverage[round(sqrt(Period))](inner)c1 = HULLa > HULLa[1]c2 = HULLa < HULLa[1]2nd
123Hulla = HullAverage[170](typicalPrice)c1 = HULLa > HULLa[1]c2 = HULLa < HULLa[1]3rd
123Hulla = average[170,8](typicalPrice)c1 = HULLa > HULLa[1]c2 = HULLa < HULLa[1]then similar for Hullb and Hullc
01/18/2021 at 8:06 PM #15837901/18/2021 at 8:15 PM #158388Interesting that the odd one out is average[20,8](typicalprice)
You’d think that it and HullAverage[20](typicalPrice) would be the same.
But they all look v close in that test, nothing like the variation I’m getting.
01/18/2021 at 8:35 PM #158391odd one out is average[20,8](typicalprice)
where did you get 8 from?
See attached, now unless v11 is different from v10.3 … Simple MS is 0 which makes Hull 7 and 8 is Zero Lag Exponential?
Attached is from v11 btw
1 user thanked author for this post.
01/18/2021 at 8:53 PM #15839401/18/2021 at 8:58 PM #158397Arrggh! you’re right, I’m a numpty, 7 is Hull, not 8.
Just ran another test, average[20,7] and HullAverage[20] are indeed the same. That’s a relief.
But (unless I’ve made another stupid mistake somewhere) neither is anywhere close to Vonasi’s code that I had been using.
Attached are the 2 test algos.
01/18/2021 at 9:18 PM #158401neither is anywhere close to Vonasi’s code that I had been using.
I guess without the PRT code for average[20,7] and HullAverage[20] … we’ll never know what the difference is?
Which to use going forward eh??
01/18/2021 at 10:12 PM #158404I think I’ll stick with the coded version. There’s no optimization of any of the others (0-8) that get that result.
01/18/2021 at 10:14 PM #158405Hahah and if we use 7 then all 3 Hulls show the same curve
Well spotted Grahal. I just assumed 8 was the hull average. Then again my hatred of lagging curve fitted averages of any kind leaves me a little inexperienced with them!
01/18/2021 at 10:18 PM #158406The difference could be starting points and the averages being calculated differently at barindex zero but I am only guessing. What are the compared results if you make the backtest start on a certain date well into the data sample?
01/18/2021 at 10:40 PM #158407running them both from June 2017 there’s a similar difference ~20%
We might have to start calling this the Vonasi Moving Average.
Looking at the Alan Hull formula, is (price) the same as (high+low+close)/3 ?
01/18/2021 at 11:06 PM #158411Borrowed description from elsewhere – ‘The Hull Moving Average uses two different weighted moving averages of price, plus a third WMA to smooth the raw moving average’. So the ‘price’ can be typical price, weighted price, total price or actual price. I stole the code from somewhere else so unless PRT stole it from the same place (or from me!) then I suspect Hull average is supposed to be calculated using typical price as they all agree on the returned value.
At the end of the day whatever ‘price’ you use in the calculation matters very little – it s still an average that can be curve fitted so why not just use all Hull averages based on all possible price types and all possible periods until you find one that fits!
1 user thanked author for this post.
01/19/2021 at 8:48 AM #158425 -
AuthorPosts
Find exclusive trading pro-tools on