Can anyone tell me why this indicator will not show or display on the 4 hr and 2 hr timeline? Works for everything else.
Code:
# Position Label with Avg Price
def GetAveragePrice = GetAveragePrice();
def GetNetLiq = GetNetLiq();
def GetOpenPL = GetOpenPL();
def GetQuantity = GetQuantity();
def GetTotalCash = GetTotalCash();
def cost = GetAveragePrice();
def qty = GetQuantity();
def purchase = qty * cost ;
def present = qty * close ;
def gainloss = present - purchase ;
def GLpct = Round(gainloss / purchase, 3) ;
addLabel(1, "Qty = " + GetQuantity +
" Avg = $" + GetAveragePrice +
" P/L = $ " + GetOpenPl +
" : " + AsPercent(GLpct), if GetOpenPL > 0 then color.light_green else if GetOpenPL < 0 then color.light_red else color.dark_gray);
plot tradePrice = if GetQuantity() > 0 then GetAveragePrice else double.nan;
tradeprice.setdefaultColor(color.cyan);
tradeprice.setlineweight(4);
def avgprice =(if isNaN(TRADEPRICE[-1]) then TRADEPRICE else Double.NaN);
plot StradePrice = if GetQuantity() < 0 then GetAveragePrice else double.nan;
Stradeprice.setdefaultColor(color.magenta);
Stradeprice.setlineweight(4);
def Savgprice =(if isNaN(STRADEPRICE[-1]) then STRADEPRICE else Double.NaN);
#AddChartBubble(StradePrice, Savgprice, "AVG:" + AsDollars(getAveragePrice), Color.magenta);
#AddChartBubble(tradePrice, avgprice, "AVG:" + AsDollars(getAveragePrice), Color.cyan);