#hint:Plots the high, low and close and open of inputted days ago\n The plots persist across to the right of the chart.\n Bubbles identify the plots.\nWorks for all aggregations thru 'Day'. declare upper; declare hide_on_daily; input DaysAgo = 1;#hint DaysAgo: Excludes today input PlotHigh = yes; input PlotLow = yes; input PlotClose = yes; input PlotOpen = no; input ShowBubbles = yes; def AdjDaysAgo = DaysAgo + 1;#Adjusted to match a true LastDate which includes today def day = GetDay(); def lastDay = GetLastDay(); def year = GetYear(); def lastYear = GetLastYear(); def yyyymmdd = GetYYYYMMDD(); def lastDate = HighestAll( if day == lastDay and year == lastYear then yyyymmdd else Double.NaN ); def currentDate = if yyyymmdd < lastDate then yyyymmdd else lastDate; def tradingDaysAgo = CountTradingDays( currentDate, lastDate ); def previousDayPlus = tradingDaysAgo <= AdjDaysAgo; def today = lastDate == currentDate; script previousPlot { input today = no; input previousDayPlus = no; input data = high; plot previousPlot = if previousDayPlus then HighestAll(if today then data else Double.NaN) else Double.NaN; } plot previousHigh = previousPlot(today, plotHigh and previousDayPlus, high( period = "DAY" )[DaysAgo]); previousHigh.setdefaultColor (color.dark_green); plot PreviousLow = previousPlot(today, plotLow and previousDayPlus, low( period = "DAY" )[DaysAgo]); previousLow.setdefaultColor (color.red); plot PreviousClose = previousPlot(today, plotClose and previousDayPlus, close( period = "DAY" )[DaysAgo]); previousClose.setDefaultColor (color.BLACK ); #plot PreviousOpen = previousPlot(today, plotOpen and previousDayPlus, open( period = "DAY" )[DaysAgo]); #=========== Chart Bubbles ===================