9 Day Exponential Moving Average Scanner

ahibbitts

New member
VIP
I would like to see if its possible and would like to help develop an indicator/scanner that can identify when two 5 min candle fills above the 9 Day MA and indicate a Green Up Arrow then two fills below will indicate Red Down Arrow. Would like to have both added to scanner watchlist when it occurs. If anyone has a starting point I would like to help to learn more.
 

rad14733

Well-known member
VIP
So, rather than a simple crossover you want two candles to close either above or below the 9 MA line...??? It would be just 9 MA, not 9 days... You pick the timeframe independent of the 9 period logic...

Should this be SMA, EMA, other...??? Ah, says EMA in the title but not the text... 💡
 

ahibbitts

New member
VIP
Correct, When two consecutive candles fill above the 9 Day Exponential Moving Average on a 5 min Chart it should indicate a Green Up Arrow and notify (sound) as well then when two consecutive candles fill below the 9 Day Exponential Moving Average it should indicate a Red Arrow Down. I would like to use this as a scanner to a watchlist as well.
 

rad14733

Well-known member
VIP
Here is the basic logic...

Ruby:
plot twoUp = close is greater than MovAvgExponential()."AvgExp" and close[1] is greater than MovAvgExponential()."AvgExp"[1] and close crosses above MovAvgExponential()."AvgExp" within 2 bars;
twoUp.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Up);
twoUp.SetLineWeight(3);
twoUp.SetDefaultColor(Color.GREEN);


plot twoDn = close is less than MovAvgExponential()."AvgExp" within 1 bar and close[1] is less than MovAvgExponential()."AvgExp"[1] and close crosses below MovAvgExponential()."AvgExp"  within 2 bars;
twoDn.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Down);
twoDn.SetLineWeight(3);
twoDn.SetDefaultColor(Color.RED);
 

rad14733

Well-known member
VIP
Looks like it worked... Yeah, I use Copy & Paste constantly throughout every day but have customers that I have to remind how almost every time I'm on a service call... It just never seems to stick in the gray matter... I couldn't function without Cut, Copy & Paste... Ctrl+X = Cut... Ctrl+C = Copy... Ctrl+V = Paste...
 

ahibbitts

New member
VIP
Found it!! Thanks again. I will continue to work on this.

Code:
#Plot Two Candle Fills Above MA
plot twoUp = close is greater than MovAvgExponential()."AvgExp" and close[1] is greater than MovAvgExponential()."AvgExp"[1] and close crosses above MovAvgExponential()."AvgExp" within 2 bars;
twoUp.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Up);
twoUp.SetLineWeight(3);
twoUp.SetDefaultColor(Color.GREEN);

#Plot Two Candle Fills Below MA
plot twoDn = close is less than MovAvgExponential()."AvgExp" within 1 bar and close[1] is less than MovAvgExponential()."AvgExp"[1] and close crosses below MovAvgExponential()."AvgExp"  within 2 bars;
twoDn.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Down);
twoDn.SetLineWeight(3);
twoDn.SetDefaultColor(Color.RED);

# Alerts
Alert(twoUp, " ", Alert.Bar, Sound.Chimes);
Alert(twoUp, " ", Alert.Bar, Sound.Bell);
Alert(twoDn, " ", Alert.Bar, Sound.Chimes);
Alert(twoDn, " ", Alert.Bar, Sound.Bell);
 

Similar threads

Top