Indicator with Hull MA: how to resolve errors

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #111600 quote
    Analyst
    Participant
    New

    Hi

    I am trying to build an indicator with the Hull moving average. There have been similar questions with no comprehensive answer, so I am posting a bit more detail in the hopes of being able to resolve this. It would appear to be an issue within PRT, but the cause of the issue is not yet resolved.

    When I program the following code:

    a=average[20,8](close)
    return a

    I get the following error: Error in the indicator: MyIndicator. Define the type of moving average.

    But the type is defined as (8) which applies to the Hull MA. If one adds a variable (type, MA, Hull) PRT assigns a variable value of 8 but still returns the error when trying to display the indicator.

    As an additional comment: if I try to use the simplified creation of code in ProBackTest, and I select the Hull moving average off my chart, the created code is for a simple moving average and not the Hull moving average, so it appears (at least for some users) that the Hull moving average is not functional and cannot be used directly in any of the PRT modules.

    Any help would be happily accepted.

    #111603 quote
    Vonasi
    Moderator
    Master

    Analyst – Please do not double post You asked a similar question in your first ever post to these forums. Double posting just leads to wasted time and confusion for those trying to help you.

    #111604 quote
    Vonasi
    Moderator
    Master

    The Hull average is average type 8 on v11 but not on v10.3 as v10.3 only has average types 0  to 6. Default for any other value is SMA.

    If you want the Hull average in v10.3 then just add this code as an indicator.

    Period = 20 // or whatever period you want
    
    HullAverage = WeightedAverage[ROUND(SQRT(close))](2 * WeightedAverage[ROUND(Period / 2)](close) - WeightedAverage[Period](close))
    
    return HullAverage
    Analyst thanked this post
    #111609 quote
    Analyst
    Participant
    New

    Thank you. It works now with a slight modification:

    Period = 20 // or whatever period you want
    
    HullAverage = WeightedAverage[ROUND(SQRT(Period))](2 * WeightedAverage[ROUND(Period / 2)](close) - WeightedAverage[Period](close))
    
    return HullAverage

    The first ‘close’ should be ‘Period’.

    #111611 quote
    Vonasi
    Moderator
    Master

    I didn’t test it – I just cut and paste it from elsewhere after doing a search using the search box for ‘Hull average’. It must be wrong in the post I got it from.

    Most questions such as yours have been asked before so the search box is always a good starting point to find an answer before creating a new topic.

    #111635 quote
    Analyst
    Participant
    New

    Thank you and agreed. I had done a search and found the code. The original question was trying to find out why the direct application was not working, and I had not found the answer as you explained with regards to not being implemented in 10.3. Because when one starts, it appears it is implemented. If you go to the variables window and set a variable, PRT allows you to set for Hull at 8, but then produces the error. But great to hear it will be in v11.

    #111667 quote
    Nicolas
    Keymaster
    Master

    “HullAverage” is now a reserved keyword in version 11, to get the Hull Moving Average value of the defined period, see HullAverage instruction in our documentation.

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

Indicator with Hull MA: how to resolve errors


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Analyst @analyst Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by Nicolas
6 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/30/2019
Status: Active
Attachments: No files
Logo Logo
Loading...