input higherTimeFrame = AggregationPeriod.WEEK;
input lines = no;
plot PREvLOW = low(period = higherTimeFrame )[1];
PREvLOW.SetLineWeight(3);
PREvLOW.SetDefaultColor(Color.UPTICK);
PREvLOW.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PREvLOW.sethiding(!lines);
plot PREvHIGH = high(period = higherTimeFrame )[1];
PREvHIGH.SetLineWeight(3);
PREvHIGH.SetDefaultColor(Color.DOWNTICK);
PREvHIGH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PREvHIGH.sethiding(!lines);
plot PREvCLOSE = CLOSE(period = higherTimeFrame )[1];
PREvCLOSE.SetLineWeight(3);
PREvCLOSE.SetDefaultColor(Color.PLUM);
PREvCLOSE.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PREvCLOSE.sethiding(!lines);
plot mid = (prevHIGH + prevLOW)/2;
mid.SetLineWeight(3);
mid.SetDefaultColor(Color.white);
mid.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
mid.sethiding(!lines);
input bubbles = no;
AddChartBubble(bubbles and BarNumber() == HighestAll(BarNumber()) and YES, Round(mid), "MID Line in the Sand: " + Round(mid), Color.WHITE);
AddChartBubble(bubbles and BarNumber() == HighestAll(BarNumber()) and YES, Round(PREvHIGH), "PREVious HIGH $: " + Round(PREvHIGH), Color.RED);
AddChartBubble(bubbles and BarNumber() == HighestAll(BarNumber()) and YES, Round(PREvLOW), "PREVious LOW $: " + Round(PREvLOW), Color.GREEN);
AddChartBubble(bubbles and BarNumber() == HighestAll(BarNumber()) and YES, Round(PREvCLOSE), "CLOSE Line In The Sand $: " + Round(PREvCLOSE), Color.PLUM);
input labels = yes;
Addlabel(labels, "MID Line in the Sand: " + Round(mid), Color.WHITE);
Addlabel(labels, "PREVious HIGH $: " + Round(PREvHIGH), Color.RED);
Addlabel(labels, "PREVious LOW $: " + Round(PREvLOW), Color.GREEN);
Addlabel(labels, "CLOSE Line In The Sand $: " + Round(PREvCLOSE), Color.PLUM);