3 versions of the Hull Average

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #158362 quote
    nonetheless
    Participant
    Master

    For the past year, before v11, I have been using this hard coded version of the Hull average:

    Period = 20
    inner = 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

    HullAverage[20](typicalPrice)

    or

    average[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)]

    Monobrow, GraHal, TraderGlyn and Midlanddave thanked this post
    Hull-test-1.jpg Hull-test-1.jpg Hull-test-2.jpg Hull-test-2.jpg Hull-test-3.jpg Hull-test-3.jpg
    #158369 quote
    Vonasi
    Moderator
    Master

    Have you created an indicator to compare them all directly? My platform is closed at the moment so I can’t test.

    Period = 20
    inner = 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, hull3
    TraderGlyn thanked this post
    #158372 quote
    nonetheless
    Participant
    Master

    I made copies of the algo. The first one has

    Period= 170
    inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)
    HULLa = weightedaverage[round(sqrt(Period))](inner)
    c1 = HULLa > HULLa[1]
    c2 = HULLa < HULLa[1]

    2nd

    Hulla = HullAverage[170](typicalPrice)
    c1 = HULLa > HULLa[1]
    c2 = HULLa < HULLa[1]

    3rd

    Hulla = average[170,8](typicalPrice)
    c1 = HULLa > HULLa[1]
    c2 = HULLa < HULLa[1]

    then similar for Hullb and Hullc

    #158379 quote
    GraHal
    Participant
    Master

    Re Vonasi code … on 5 min TF, 2 are the same value and 1 is different from the other 2 … see attached.

    Hull-x3.jpg Hull-x3.jpg
    #158388 quote
    nonetheless
    Participant
    Master

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

    #158391 quote
    GraHal
    Participant
    Master

    odd 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

    nonetheless thanked this post
    Hull.jpg Hull.jpg
    #158394 quote
    GraHal
    Participant
    Master

    Hahah and if we use 7 then all 3 Hulls show the same curve … see attached.

    Hull-3.jpg Hull-3.jpg
    #158397 quote
    nonetheless
    Participant
    Master

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

    NAS-2m-HULL-SAR-v5.3.itf NAS-2m-HULL-SAR-v5.3L2.itf
    #158401 quote
    GraHal
    Participant
    Master

    neither 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??

    #158404 quote
    nonetheless
    Participant
    Master

    I think I’ll stick with the coded version. There’s no optimization of any of the others (0-8) that get that result.

    #158405 quote
    Vonasi
    Moderator
    Master

    Hahah 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!

    #158406 quote
    Vonasi
    Moderator
    Master

    The 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?

    #158407 quote
    nonetheless
    Participant
    Master

    running 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 ?

    #158411 quote
    Vonasi
    Moderator
    Master

    Borrowed 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!

    nonetheless thanked this post
    #158425 quote
    Nicolas
    Keymaster
    Master

    BTW, average[20,8](typicalprice) and HullAverage[20](typicalPrice) should not be different, I’m going to ask the reason why!

Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.

3 versions of the Hull Average


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 18 replies,
has 5 voices, and was last updated by robertogozzi
5 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/18/2021
Status: Active
Attachments: 9 files
Logo Logo
Loading...