More of a thinkscript question but how do I only plot on the current day? I have the following code that plots yesterday's high, low, open and close and it works fine, but it also plots on all the prior days as well. The chart bubble only shows up for the current day, but I can't duplicate that same functionality for the horizontal lines. Thanks in advance!
Code:
input higherTimeFrame = AggregationPeriod.DAY;
input Lookback = 1;
input first_day_of_week = {default Monday};
def should_hide_close = GetDayofWeek(GetYYYYMMDD()) == first_day_of_week + 1;
plot PREvLOW = low(period = higherTimeFrame)[Lookback];
PREvLOW.SetLineWeight(1);
PREvLOW.SetDefaultColor(Color.UPTICK);
PREvLOW.SetPaintingStrategy(PaintingStrategy.DASHES);
plot PREvHIGH = high(period = higherTimeFrame)[Lookback];
PREvHIGH.SetLineWeight(1);
PREvHIGH.SetDefaultColor(Color.DOWNTICK);
PREvHIGH.SetPaintingStrategy(PaintingStrategy.DASHES);
plot PREvCLOSE = if should_hide_close then double.NaN else close(period = higherTimeFrame)[Lookback];
PREvCLOSE.SetLineWeight(1);
PREvCLOSE.SetDefaultColor(Color.YELLOW);
PREvCLOSE.SetPaintingStrategy(PaintingStrategy.DASHES);
def shouldPlot = BarNumber() == HighestAll(BarNumber());
plot open = open(period = higherTimeFrame)[Lookback];
open.SetLineWeight(1);
open.SetDefaultColor(Color.white);
open.SetPaintingStrategy(PaintingStrategy.DASHES);
AddChartBubble(BarNumber() == HighestAll(BarNumber()) and YES, Round(open), "PD Open: " + Round(open), Color.WHITE);
AddChartBubble(BarNumber() == HighestAll(BarNumber()) and YES, Round(PREvHIGH), "PD High: " + Round(PREvHIGH), Color.RED);
AddChartBubble(BarNumber() == HighestAll(BarNumber()) and YES, Round(PREvLOW), "PD Low: " + Round(PREvLOW), Color.GREEN);
AddChartBubble(BarNumber() == HighestAll(BarNumber()) and YES, Round(PREvCLOSE), "PD Close: " + Round(PREvCLOSE), Color.YELLOW);