This indicator shows previous periods (day and week) high, low and open.
I would like to add options so I can choose how many periods it should go back.
For example, only the last day or week, or 2 days or weeks.
Any help would be great for me.
Thank you!
study(title="Previous Day High and Low + OPENS", shorttitle="HLO", overlay=true)
D_High = security(tickerid, 'D', high[1])
D_Low = security(tickerid, 'D', low[1])
D_Close = security(tickerid, 'D', close[1])
D_Open = security(tickerid, 'D', open[1])
W_High = security(tickerid, 'W', high[1])
W_Low = security(tickerid, 'W', low[1])
plot(isintraday ? D_High : na, title="Daily High",style=line, color=black,linewidth=1)
plot(isintraday ? D_Low : na, title="Daily Low",style=line, color=black,linewidth=1)
plot(isintraday ? W_High : na, title="Weekly High",style=line, color=black,linewidth=1)
plot(isintraday ? W_Low : na, title="Weekly Low",style=line, color=black,linewidth=1)
openPriceD = security(tickerid, 'D', open)
openPriceW = security(tickerid, 'W', open)
openPriceM = security(tickerid, 'M', open)
plot(openPriceD ? openPriceD : na, title="Daily Open", style=circles, linewidth=2, color=purple)
plot(openPriceW ? openPriceW : na, title="Weekly Open", style=circles, linewidth=2, color=green)
plot(openPriceM ? openPriceM : na, title="Monthly Open", style=circles, linewidth=2, color=red)