Please help me with my code.
here is my pinesctypt code
//@version=4
//——————————————————————————————-
study(title="previous Week high & low", shorttitle="Prev Wk H-L", overlay=true, precision=8)
prevwkH = input(true, title="Show previous week high?")
prevwkL = input(true, title="show previous week low?")
//previous week
prevWeekHigh = security(syminfo.tickerid, '3W', high[1], lookahead=true)
prevWeekLow = security(syminfo.tickerid, '3W', low[1], lookahead=true)
var float weekClose = security(syminfo.tickerid, '3W', close[1])
mid = (prevWeekHigh + prevWeekLow + weekClose) / 3
upper = mid + ((prevWeekHigh - prevWeekLow) / 2)
lower = mid - ((prevWeekHigh - prevWeekLow) / 2)
//previous Week Plots
plot(prevwkH ? mid : na, title="mid", style=plot.style_linebr, linewidth=1, color=color.fuchsia, transp=20)
plot(prevwkL ? upper : na, title="upper", style=plot.style_linebr, linewidth=1, color=color.fuchsia, transp=20)
plot(prevwkL ? lower : na, title="lower", style=plot.style_linebr, linewidth=1, color=color.fuchsia, transp=20)``
I want there to be plotted 3 lines for each week, but i feel like some value is not getting reset, and after a few weeks my lines are getting shifted, can somebody help me fix this?
Beginning
End
i want lines to be precise and recalculated for each week using 3 previous weeks, but they are getting shifted as if old values are used
Matvey Kandalintsev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.