# Make an average shorter than a 2 EMA but more than a 1 EMA?

#### Piper2808t

##### Member
2019 Donor
VIP
I know of a trader that does very well if a daily candles low is greater than a 2 day ema on a daily chart or its high is less then the 2 day ema on a daily chart . The rules are simple. 1. if the low closes above the 2 ema he waits the next day to go short if price breaks yesterdays low , if the high closes below the 2 day ema he goes long the next day if price breaks yesterdays high. There are some nice signals on this setup; however, if there was a way to create an ema that was perhaps 1.5 or 1.75 to shorten the ema a little some false signals may be eliminated. Obviously a 1ema will not work any help would be great thanks. shared the study which is td avgexp with just assignpricecolor changes

Code:
``````# TD Ameritrade IP Company, Inc. (c) 2017-2019
#

input price = close;
input length = 2;
input displace = 0;
input showBreakoutSignals = no;

plot AvgExp = ExpAverage(price[-displace], length);
plot UpSignal = price crosses above AvgExp;
plot DownSignal = price crosses below AvgExp;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

AvgExp.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
assignpricecolor(if low > avgexp then color.red else if high< avgexp then color.green else color.gray);``````

Last edited by a moderator: