Compression / Expansion of MAs
Forums › ProRealTime English forum › ProScreener support › Compression / Expansion of MAs
- This topic has 2 replies, 2 voices, and was last updated 2 years ago by Khaled.
-
-
07/30/2022 at 8:20 AM #198106
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
Compression/Expansion EMAs12345678910111213141516c1 =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 = 5if 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 thenDRAWPOINT(barindex, close-10, 5)coloured("cyan")c1 = 1endifscreener[c1](RSI[14])07/30/2022 at 10:51 AM #198117There you go:
1234567891011121314151617MAType = 1EMA5 = 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 * PipSizeMaxEma = 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) <= Treshold1screener[c1](((MaxEma - MinEma) / PipSize) AS "Gap")//(RSI[14])//screener[c1](RSI[14]This is an indicator to show the GAP bwtween them:
123456789101112131415MAType = 1EMA5 = 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 * PipSizeMaxEma = 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) <= Treshold1RETURN Gap AS "Minimum Gap"And this one is the indicator I used to plot the averages:
123456789MAType = 1EMA5 = 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"1 user thanked author for this post.
07/30/2022 at 11:34 AM #198123Thanks a million Roberto, to the point as always!
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on