New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

macd hist

I want to know when the macd hist changes sign, i.e. goes from plus to minus or vice versa. I am using [macd hist > 0] or [macd hist < 0] to try to do this. The only problem I get an alert regardless whether the macd hist has crossed the zero line or not. Help

Best Answer

  • gordgord admin
    Accepted Answer
    Yes I see with that coding you are checking to see if the MACD is greater than 0 or less than 0. Problem is one or the other will always be true and trigger an alert.

    You are really looking for the crossover, so we need to require the MACD to be less than 0 yesterday and then greater than 0 today. And Visa Versa.

    The other way is to use the crossover "X" function which does the same thing in one line of code.

    and [MACD Hist(12,26,9) X 0.0]

    In this case the MACD has to cross above 0, you can also reverse it to get the MACD crossing below 0 (or as it reads the 0 is crossing above MACD.)

    and [ 0.0 X MACD Hist(12,26,9)]
Sign In or Register to comment.