psk 15min levels 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// ©psk337
//////i copied the code and made it as per mine not my orignal code and rights reseved to admin@ TRADEMASTER EDUTECH
//@version=4
study(title="psk 15min levels ", shorttitle=" psk15minlev ", overlay=true)
up15on = input(true, title="15 Minute Opening Range High")
down15on = input(true, title="15 Minute Opening Range Low")


is_newbar(res) => change(time(res)) != 0

adopt(r, s) => security(syminfo.tickerid, r, s)

//high_range = valuewhen(is_newbar('D'),high,0)
//low_range = valuewhen(is_newbar('D'),low,0)



high_rangeL = valuewhen(is_newbar('D'),high,0)  
low_rangeL = valuewhen(is_newbar('D'),low,0)
diff = (high_rangeL-low_rangeL)/2
diff2 = (high_rangeL-low_rangeL)
diffavg = (high_rangeL-low_rangeL)/2
diffval = (high_rangeL-low_rangeL)/2
up15 = plot(up15on ? adopt('15', high_rangeL): na, color = #009900, linewidth=1,style=plot.style_line)
down15 = plot(down15on ? adopt('15', low_rangeL): na, color = #ff0000, linewidth=1,style=plot.style_line)

diffup15 = plot(up15on ? adopt('15', (high_rangeL+diff)): na, color = #009900, linewidth=1,style=plot.style_line)
diffdown15 = plot(down15on ? adopt('15', (low_rangeL-diff)): na, color = #ff0000, linewidth=1,style=plot.style_line)

diff2up15 = plot(up15on ? adopt('15', (high_rangeL+diff2)): na, color = #009900, linewidth=1,style=plot.style_line)
diff2down15 = plot(down15on ? adopt('15', (low_rangeL-diff2)): na, color = #ff0000, linewidth=1,style=plot.style_line)
diffavgdown15 = plot(down15on ? adopt('15', (low_rangeL+diff)): na, color = #ff0000, linewidth=1,style=plot.style_line)
diffvaldown15 = plot(down15on ? adopt('15', (diffval)): na, color = #ff0000, linewidth=1,style=plot.style_line)