Hull average Uptrend downtrend alert

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #84526 quote
    jptrader
    Participant
    New

    Hi everyone,

    This is my first post and was hoping I could get some help with my proscreener. I am looking for a code to alert me when my hull average changes from downtrend to uptrend (i.e. colour changes on the chart). Below is the Hull average code I’m using (it is taken from a blog post by Nicolas ), and I’m unsure what  I need to add to make it work for the alert.

    Many thanks in advance.

    JP

    Hull Average Code:

    //Hull Average Code:
    
    //HullMA, the Hull Moving Average:
    Period = 14
    Data = Close
    inner = 2*weightedaverage[round(Period/2)](Data)-weightedaverage[Period](Data)
    S = weightedaverage[round(sqrt(Period))](inner)
    return S
    #84532 quote
    robertogozzi
    Moderator
    Master

    To write code, please use the <> “insert PRT code” button, to make your code easier to read. Thank you.

    S is what is returned and displayed on the chart, so you just need to check if current S is different from the previous candle, if it’s higher then it’s bullish while if it’s lower then it’s bearish:

    //HullMA, the Hull Moving Average:
    Period = 14
    Data = Close
    inner = 2*weightedaverage[round(Period/2)](Data)-weightedaverage[Period](Data)
    S = weightedaverage[round(sqrt(Period))](inner)
    Result = 0
    IF S > S[1] THEN       //higher than previous
       Result = 1
    ELSIF S < S[1] THEN    //lower then previous
       Result = 2
    ENDIF
    SCREENER [Result]
    
    #84544 quote
    jptrader
    Participant
    New

    Thank you much appreciated. Will have a look over the weekend! 🙂

    #84568 quote
    jptrader
    Participant
    New

    Thank you, I have put the code into the screener but realised it will also show as a buy if the hull is going up relative to the previous price.

    I was wondering if it is possible to change the so that it only flags up the security when the colour change happens, so only the first move from negative to positive and vice versa?

    Also, how do I add into the code a second hull moving average so that when both are both bullish or both bearish I get an alert?  Do I just add “and” into the bottom of the code?

     

    Many thanks, and apologies for the stupid questions, as you can tell, coding isn’t one of my strong points.

    JP

    #84569 quote
    jptrader
    Participant
    New

    Hi again,

    Don’t worry about the adding of the second indicator, I have found some info on how to sort that.

    Final question, is it possible to open two proscreener windows so I can check multiple screening options, so have one bearish open and one bullish?

     

    Many thanks

    JP

    #84574 quote
    robertogozzi
    Moderator
    Master

    You can open many screeners, I don’t know about any limit, just duplicate your screener with a different name.

    The correct code is:

    Result = 0
    Bull   = S > S[1]
    Bear   = S < S[1]
    IF Bull AND Bear[1] THEN       //Red to Green
       Result = 1
    ELSIF Bear AND Bull[1] THEN      //Green to Red
       Result = 2
    ENDIF
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Hull average Uptrend downtrend alert


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
jptrader @jptrader Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by robertogozzi
7 years, 3 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 11/10/2018
Status: Active
Attachments: No files
Logo Logo
Loading...