#//author @TraderX0
#//script to plot Opens for daily weekly and monthly
#//version 1.0
#study(title="Opens", shorttitle="Opens", overlay=true)
#// holds the daily price levels
#f_htf_ohlc(_htf) =>
script htf {
input _htf = AggregationPeriod.DAY;
def time = close(period = _htf);
def htf_cx;
if (time != time[1]) {
htf_cx = time[1];
} else {
htf_cx = htf_cx[1];
}
plot cx = if isNaN(close) then Double.NaN else htf_cx;
}
def openPriceD = open(Period = "day");#security(tickerid, 'D', open)
def openPriceW = open(Period= "week");#security(tickerid, 'W', open)
def openPriceM = open(Period = "month");# rid, 'M', open)
def na = Double.NaN;
#//plot levels
plot OpenDay = if openPriceD then openPriceD else na;#, title="Daily Open", style=circles, linewidth=2, color=purple)
OpenDay.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
OpenDay.SetDefaultColor(Color.MAGENTA);
plot openWeek = if openPriceW then openPriceW else na;#, title="Weekly Open", style=circles, linewidth=2, color=green)
openWeek.SetDefaultColor(Color.GREEN);
openWeek.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
plot openMonth = if isNaN(openPriceM) then htf("month") else openPriceM;#, title="Monthly Open", style=circles, linewidth=2, color=red)
openMonth.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
openMonth.SetDefaultColor(Color.RED);