MACD crossover in a trend

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #179996 quote
    MrMagic
    Participant
    Average

    Hi,

    Could you please check this screener and see whether I am close. It gave some results but I wanted confirmation that I coded the right thing?

    Thanks.

    CRITERIA

    UP

    1. EMA 5 above EMA20, which is above EMA 50 and EMA100
    2. Bullish MACD crossover with MACD line crossing above the signal line

     

    DOWN

    1. EMA 5 below EMA20, which is below EMA 50 and EMA100
    2. Bullish MACD crossover with MACD line crossing below the signal line

    Ideally. I’ll want the bullish MACD crossover in the uptrend to happen below the zero line and the bearish MACD crossover to happen above the zero line.

     

    Cheers.

    Ema100 = Average [100,1] (close)
    Ema50 = Average [50,1] (close)
    Ema20 = Average [20,1] (close)
    Ema5 = Average [5,1] (close)
    MacdVal = Macd [12,26,9] (close)
    
    UP = Ema5 > Ema20 AND Ema20 > Ema50 AND Ema50 > Ema100
    DN = Ema5 < Ema20 AND Ema20 < Ema50 AND Ema50 < Ema100
    
    Upa = summation [3] (MacdVal CROSSES OVER 0)
    DNa = summation [3] (MacdVal CROSSES UNDER 0)
    
    Result = 0
    IF UP and UPa THEN
    Result = 1
    ELSIF DN and DNa THEN
    Result = 2
    ENDIF
    SCREENER[Result] (Result AS "1=Up/2=Dn")
    NeoTrader thanked this post
    #179998 quote
    robertogozzi
    Moderator
    Master

    The CROSSES OVER 0 means that now it must be over 0 and the previous candle it was below 0, so it will always occur while below 0.

    You added that the crossovers must have occurred in the last 3 candles, the current one or any of the two prior ones.

    Yes, it’s all correct.

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

MACD crossover in a trend


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
MrMagic @mrmagic Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
4 years, 4 months ago.

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