# PreviousPeriodClose
#
input aggregationPeriod = AggregationPeriod.FIVE_MIN;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;
plot PrevPeriodClose;
PrevPeriodClose.SetLineWeight(2);
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) { PrevPeriodClose = Double.NaN;
} else { PrevPeriodClose = Highest(close(period = aggregationPeriod)[-displace], length);
}
PrevPeriodClose.SetDefaultColor(GetColor(9));
PrevPeriodClose.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#
AddLabel(yes,"PrevPeriodClose " + PrevPeriodClose, if close > PrevPeriodClose then Color.LIME else Color.RED);
#
# End code-----------------------------