```
#By Jefe 10/06/2021 for #TheStrat-ers
# Draws high/low price lines for insidebars and the high/low price for the candle before the insidebar to identify possible entry/exits on insidebar patterns.
#------------------------------------
def insidebar = High < High[1] and Low > Low[1];
def price1 = ((high) and isnan(insidebar[-1]));
def price2 = ((high) and isnan(insidebar[-1]));
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input displace2 = -2;
input displace3 = -1;
plot longin = if price1 and insidebar[1] then (high(period = aggregationperiod)[-displace]) else double.nan;
Longin.SetDefaultColor(GetColor(6));
longin.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
addchartbubble(longin, longin, longin, color.Green, No);
plot shortin = if price1 and insidebar[1] then (low(period = aggregationperiod)[-displace]) else double.nan;
shortin.SetDefaultColor(GetColor(6));
shortin.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
addchartbubble(shortin, shortin, shortin, color.Green, yes);
plot longout = if price2 and insidebar[1] then (high(period = aggregationperiod)[-displace2]) else double.nan;
Longout.SetDefaultColor(GetColor(5));
longout.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
addchartbubble(longout, longout, longout, color.red, Yes);
plot Shortout = if price2 and insidebar[1] then (low(period = aggregationperiod)[-displace2]) else double.nan;
Shortout.SetDefaultColor(GetColor(5));
Shortout.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
addchartbubble(shortout, shortout, shortout, color.red, no);
plot FiftyRetrace = if price2 and insidebar[1] then (hl2(period = aggregationperiod)[-displace3]) else double.nan;
FiftyRetrace.SetDefaultColor(GetColor(7));
FiftyRetrace.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
```