Compression / Expansion of MAs

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #198106 quote
    Khaled
    Participant
    Veteran

    Hello,

    I’d like to screen securities for which MAs, for example Exponential MA 5/8/13/21/34/50, compress then expand like on the attached screenshot (SP500 TF M15). I tried to calculate the difference between MAs and put a condition if the difference is <= to a certain fixed value say (5) for example but it misses many occurrences or generates many false signals.

    Can someone please come with a solution where the delta is relative without being too big? may be using std or atr or ste or other function or may be should introduce a loop?

    Thanks

    I tried the code below but it either show too many occurrences (false signals) or misses signals

    c1 = 
    
    EMA5 = average[5,MAType](close)
    EMA8 = average[8,MAType](close)
    EMA13 = average[13,MAType](close)
    EMA21 = average[21,MAType](close)
    EMA34 = average[34,MAType](close)
    EMA50 = average[50,MAType](close)
    Threshhold1 = 5
    
    if abs(EMA5-EMA8) <= Threshhold1 and abs(EMA8-EMA13) <= Threshhold1 and abs(EMA13-EMA21) <= Threshhold1 and abs(EMA21-EMA34) <= Threshhold1 and abs(EMA34-EMA50) <= Threshhold1 and abs(EMA50-EMA100) <= Threshhold1 and abs(EMA100-EMA200) <= Threshhold1 then
    DRAWPOINT(barindex, close-10, 5)coloured("cyan")
    c1 = 1
    endif
    
    screener[c1](RSI[14])
    
    
    Capture-décran-2022-07-30-à-09.06.48.png Capture-décran-2022-07-30-à-09.06.48.png
    #198117 quote
    robertogozzi
    Moderator
    Master

    There you go:

    MAType = 1
    EMA5  = average[5,MAType](close)
    EMA8  = average[8,MAType](close)
    EMA13 = average[13,MAType](close)
    EMA21 = average[21,MAType](close)
    EMA34 = average[34,MAType](close)
    EMA50 = average[50,MAType](close)
    Treshold1 = 5 * PipSize
    
    
    MaxEma = max(Ema5,max(Ema8,max(Ema13,max(Ema21,max(Ema34,Ema50)))))
    MinEma = min(Ema5,min(Ema8,min(Ema13,min(Ema21,min(Ema34,Ema50)))))
    
    c1     = (MaxEma - MinEma) <= Treshold1
    
    screener[c1](((MaxEma - MinEma) / PipSize) AS "Gap")//(RSI[14])
    //screener[c1](RSI[14]

    This is an indicator to show the GAP bwtween them:

    MAType = 1
    EMA5  = average[5,MAType](close)
    EMA8  = average[8,MAType](close)
    EMA13 = average[13,MAType](close)
    EMA21 = average[21,MAType](close)
    EMA34 = average[34,MAType](close)
    EMA50 = average[50,MAType](close)
    Treshold1 = 5 * PipSize
    
    MaxEma = max(Ema5,max(Ema8,max(Ema13,max(Ema21,max(Ema34,Ema50)))))
    MinEma = min(Ema5,min(Ema8,min(Ema13,min(Ema21,min(Ema34,Ema50)))))
    
    Gap    = (MaxEma - MinEma) <= Treshold1
    
    RETURN Gap AS "Minimum Gap"

    And this one is the indicator I used to plot the averages:

    MAType = 1
    EMA5  = average[5,MAType](close)
    EMA8  = average[8,MAType](close)
    EMA13 = average[13,MAType](close)
    EMA21 = average[21,MAType](close)
    EMA34 = average[34,MAType](close)
    EMA50 = average[50,MAType](close)
    
    RETURN Ema5 AS "Ema5",Ema8 AS "Ema8",Ema13 AS "Ema13",Ema21 AS"Ema21", Ema34 AS "Ema34",Ema50 AS "Ema50"
    Khaled thanked this post
    #198123 quote
    Khaled
    Participant
    Veteran

    Thanks a million Roberto,  to the point as always!

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

Compression / Expansion of MAs


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Khaled @khaled Participant
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 07/30/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...