defparam drawonlastbaronly=true
//inputs
dayMax = 1.5//Maximum Daily ATR Multiple
WeekMax = 3 //Maximum weekly atr multiple
monthMax = 6 //maximum monthly atr multip0le
//atrMultiplier=2
//timeframe(daily,updateonclose)
atr=AverageTrueRange[14]//(close)[1]
dayATR = atr*dayMax
WeekATR = atr*weekMax
MonthATR = atr*monthMax
dayHigh = HighestSince(1,high)
weekhigh = HighestSince(Weekday() = 1, High)
//monthhigh = monthatr
monthHigh = highestSince(Month()<> month[1],High)
DayMaxReached = dayHigh >=(Close+dayATR)
weeklyMaxReached =weekhigh>=(Close+WeekATR)
monthMaxReached = monthHigh >=(Close+monthATR)
//Plotting
if daymaxReached then
plot1(dayHigh,"Day Max Reched",Green)
Endif
//Plotting
if weeklyMaxReached then
plot2(weekHigh,"week Max Reched",blue)
Endif
//Plotting
if monthMaxReached then
plot3(MonthHigh,"Month Max Reched",red)
Endif
//timeframe(default)
//range=abs(dhigh-dlow)
upperlvl = floor(dlow(0)+atr,decimals)
lowerlvl = floor(dhigh(0)-atr,decimals)
drawsegment(barindex,upperlvl,barindex+10,upperlvl) style(dottedline)
drawsegment(barindex,lowerlvl,barindex+10,lowerlvl) style(dottedline)
drawtext("#upperlvl#",barindex+20,upperlvl)
drawtext("#lowerlvl#",barindex+20,lowerlvl)
DRAWHLINE(upperlvl)coloured("white")
DRAWHLINE(lowerlvl)coloured("white")
return