Plot two consecutive closes above 9 EMA

grammates

New member
Hello can someone please help me I'm trying to figure out a simple code I assume, I'm looking for a simple indicator. I would like the indicator to plot a arrow when the candle closes above the 9 moving average for two candles or plot the arrow on the second candle once it closes. Thank you any help is appreciated
 

BenTen

Administrative
Staff
VIP
Try this:

Code:
input price = close;
input length = 9;
input displace = 0;
input showBreakoutSignals = no;

plot AvgExp = ExpAverage(price[-displace], length);

def condition = close[1] > AvgExp and close > AvgExp;
plot UpSignal = condition;

AvgExp.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

Alert(UpSignal, " ", Alert.Bar, Sound.Chimes);
 

MerryDay

Well-known member
VIP
@grammates use the above script w/ caution. 2 candles up don't make a trend.

Here is an example using the script that @BenTen provided.

5FApXuk.png
 

Similar threads

Top