canton mi
Experience: Beginner
Platform: ninja xtrader
Trading: tf, es
Posts: 230 since Jan 2014
Thanks Given: 328
Thanks Received: 146
|
anyone know why this tos indie wont plot it was created in 2011
declare upper;
def length = 20;
def lookBack = 13;
def period = 8;
def MA = (Highest(high[1], period) + Lowest(low[1], period)) / 2;
# Simple definition of bullish / bearish price activity and volume
def upVolume = volume > volume[1];
def dnVolume = volume < volume[1];
def upClose = close > close[1] or close > close[2];
def dnClose = close < close[1] or close < close[2];
def higherHi = high > high[1];
def lowerLo = low < low[1];
def doji = open == close;
# Identify increasing aggression (Augen's price volatility) and inflation/deflation in volume
def closeLog = Log(close[1] / close[2]);
def pDev = StDev(closeLog, length) * Sqrt(length / (length - 1));
def x = pDev * close[1];
def aggression = (close[0] - close[1]) / x;
def volLog = Log(volume[1] / volume[2]);
def vDev = StDev(volLog, length) * Sqrt(length / (length - 1));
def y = vDev * volume[1];
def volspike = ((volume[0] - volume[1]) / y);
# Welles Wilder's True Range and
def TR1 = high - low;
def TR2 = AbsValue(high - close[1]);
def TR3 = AbsValue(close[1] - low);
def Range = Max(Max(TR1, TR2), TR3);
def ATR = WildersAverage(Range, length);
def narrowRangeBar = Range < ATR;
def longBar = Range > ATR;
# Define low-volume tests at lows/highs, using power laws
def K = 4;
input alpha = 2.36;
input resistgate = 3.0;
input suppgate = 3.0;
def volOutlier = K * Power(volume, -alpha);
def volOutSpikeHi = volOutlier > resistgate * Average(volOutlier, 33);
def volOutSpikeLo = volOutlier > suppgate * Average(volOutlier, 33);
def loVolTestLow = (volOutSpikeLo ) && close < MA && narrowRangeBar;
def loVolTestHigh = (volOutSpikeHi ) && close > MA && narrowRangeBar;
# Identify and highlight high-volume pressure at lows/highs
def hiVolPressLow = upVolume && upClose && close < MA && aggression > aggression[1] && lowerLo && !doji && !longBar;
def hiVolPressHigh = dnVolume && dnClose and open > MA && close > MA && aggression < aggression[1] && higherHi && !doji && !longBar;
AssignPriceColor( if hiVolPressHigh then CreateColor(170, 0, 0) else if hiVolPressLow then CreateColor(15, 115, 80) else Color.CURRENT);
# Plot support and resistance levels as functions of significant changes in volume and display price values at which this occurs
def Support;
Support = if loVolTestLow && !loVolTestLow[-1] && !loVolTestLow[-2] && !loVolTestLow[-3] then low else Double.NaN;
plot supp = Support;
supp.SetDefaultColor(CreateColor(15, 115, 80));
supp.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
supp.SetLineWeight(1);
supp.HideBubble();
rec lastBot = if !IsNaN(Support) then low else lastBot[1];
plot priorLow = lastBot;
priorLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
priorLow.SetStyle(PaintingStrategy.DASHES);
priorLow.SetDefaultColor(CreateColor(15, 115, 80));
priorLow.SetLineWeight(1);
priorLow.HideBubble();
def Resistance;
Resistance = if loVolTestHigh && !loVolTestHigh[-1] && !loVolTestHigh[-2] && !loVolTestHigh[-3] then high else Double.NaN;
plot resist = Resistance;
resist.SetDefaultColor(CreateColor(170, 0, 0));
resist.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
resist.SetLineWeight(1);
resist.HideBubble();
rec lastsold = if !IsNaN(Resistance) then high else lastsold[1];
plot priorhigh = lastsold;
priorhigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
priorhigh.SetStyle(PaintingStrategy.DASHES);
priorhigh.SetDefaultColor(CreateColor(170, 0, 0));
priorhigh.SetLineWeight(1);
priorhigh.HideBubble();
|