Cwparker23
Member
This is just a concept that I've been working on that I wanted to share. I took the code for the buy-sell volume pressure and used ema's instead of price. I put it in the
form of the momentum indicator to show the difference.
Code:
################################
# script by Cwparker23 #
################################
declare lower;
input length = 12;
input showBreakoutSignals = no;
def ema1 = expaverage (high,length);
def ema2 = expaverage (close,length);
def ema3 = expaverage (low,length);
def vavg = expaverage (volume,length);
assert(length > 0, "'length' must be positive: " + length);
def b = ((ema2-ema3)/(ema1-ema3))* vavg;
def s = ((ema1-ema2)/(ema1-ema3))* vavg;
plot Momentum = b - s[1];
plot Momentum2 = s - b[1];
plot ZeroLine = 0;
plot UpSignal = if Momentum crosses above Momentum2 then ZeroLine else Double.NaN;
plot DownSignal = if Momentum crosses below Momentum2 then ZeroLine else Double.NaN;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
Momentum.SetDefaultColor(GetColor(1));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Last edited by a moderator: