EventHorizon
New member
Hi all,
I had a panel indicator that has suddenly stopped working in the past two weeks, and I can't figure out why. Prior to this, it displayed without issue and now I cannot get it to show. Please help!
Here is the full code broken down into sections:
AS OF RIGHT NOW, it shows that it is added to my indicators, but it will not show on my charts at all - regardless if trying on volume, upper, or any lower panel.
I had a panel indicator that has suddenly stopped working in the past two weeks, and I can't figure out why. Prior to this, it displayed without issue and now I cannot get it to show. Please help!
Here is the full code broken down into sections:
Code:
# Daily Range / ATR
input ATRLength = 20;
def averagetype = AverageType.SIMPLE;
def showlabel = yes;
def ATR = MovingAverage (averagetype, TrueRange(high(period = AggregationPeriod.DAY)[1], close(period = AggregationPeriod.DAY)[1], low(period = AggregationPeriod.DAY)[1]), ATRLength);
def Today_High = Highest(high(period = AggregationPeriod.DAY)[0], 1);
def Today_Low = Lowest(low(period =AggregationPeriod.DAY)[0], 1);
def DR = Today_High - Today_Low;
def DTR_Pct = Round((DR / ATR) * 100, 0);
AddLabel (yes, "Daily Range: " + Round (DR, 2) + " vs. ATR: " + round (ATR, 2)+ " (" + round (DTR_Pct, 0) + "%)", (if DTR_Pct <= 70 then Color.GREEN else if DTR_Pct >= 90 then Color.RED else Color.YELLOW));
def n2 = (((ATR * 19) + DR) / 20) * 2;
def Quantity = ((getNetLiq()) / n2) * .01;
AddLabel(yes, "Position Size (Stock): " + Round(Quantity, 0), color.WHITE);
# Price Delta Aggregation
def yearstart = getyear() * 10000 + 101;
def tradedays = countTradingDays(yearstart, GetYYYYMMDD());
def closeEOY = getvalue(close, tradedays, 252);
def YTDnetchange = ((close - closeEOY)/closeEOY) * 100;
def value = round(YTDnetchange, 2);
AddLabel(yes, "YTD: " + value + "%", if value == 0
then Color.LIGHT_GRAY
else if value > 0
then CreateColor(51,204,0)
else color.RED);
def MonthClose = if GetLastMonth() == GetMonth() then close(period = aggregationPeriod.Month)[1] else Double.NaN;
def MTDnetchange = ((close - MonthClose) / MonthClose) * 100;
def valueMTD = round(MTDnetchange, 2);
AddLabel(yes, "MTD: " + valueMTD + "%", if valueMTD == 0
then Color.LIGHT_GRAY
else if valueMTD > 0
then CreateColor(51,204,0)
else color.RED);
def WeekClose = if GetLastWeek() == GetWeek() then close(period = aggregationPeriod.Week)[1] else Double.NaN;
def WTDnetchange = ((close - WeekClose) / WeekClose) * 100;
def valueWTD = round(WTDnetchange, 2);
AddLabel(yes, "WTD: " + valueWTD + "%", if valueWTD == 0
then Color.LIGHT_GRAY
else if valueWTD > 0
then CreateColor(51,204,0)
else color.RED);
# Volatility and Implied Move Approximation Label
def histvol = reference historicalvolatility;
AddLabel(1, "HV = " + AsPercent(histvol) , color.GRAY);
def IV = if IsNaN(Imp_Volatility(period = AggregationPeriod.DAY))
then IV[1]
else Imp_Volatility(period = AggregationPeriod.DAY);
def ImpliedMove = (open * IV) / Sqrt(365);
AddLabel(1, "IV = " + AsPercent(IV) + " Implied Move = " + AsDollars(ImpliedMove), color.GRAY);
# End
AS OF RIGHT NOW, it shows that it is added to my indicators, but it will not show on my charts at all - regardless if trying on volume, upper, or any lower panel.