yasParticipant
Junior
I am trying to code this indicator give you the heads up when a market has moved its maximum for the Day, Week or even Month. with use of ATR on the chart
i am little stuck trying to code this if you guys can assist me to complet this code that will be great its simple idea to see atr on the chart where market has traveled too far for the day and possible reversal from that area
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
yasParticipant
Junior
Can someone help 🙏 please
Ok, following your other request for an indicator that plots the daily ATR on an intraday chart, I understand that you want to alert by a text on the chart when the price has reached the previous daily ATR (anchored on the current daily low), or the previous weekly ATR (anchored on the current weekly low) or the previous monthly (anchored on the current monthly low).
I see that you have mixed different programming language in your approach, so I recode the it from my own understanding explained above.
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(weekly,updateonclose)
WeekATR = AverageTrueRange[14]*weekMax
timeframe(weekly)
wlow=low
whigh=high
timeframe(daily,updateonclose)
dayATR = AverageTrueRange[14]*dayMax
timeframe(monthly,updateonclose)
MonthATR = AverageTrueRange[14]*monthMax
timeframe(monthly)
mlow=low
mhigh=high
timeframe(default)
DayMaxReached = dhigh(0) >=(dlow(0)+dayATR)
weeklyMaxReached = whigh>=(wlow+WeekATR)
monthMaxReached = mhigh >=(mlow+monthATR)
//Plotting
if daymaxReached then
drawtext("Day Max Reached", 0 ,-50) anchor(top) coloured("green")
else
drawtext("Day Max NOT Reached", 0 ,-50) anchor(top) coloured("green")
Endif
////Plotting
if weeklyMaxReached then
drawtext("Week Max Reached", 0 ,-70) anchor(top) coloured("blue")
else
drawtext("Week Max NOT Reached", 0 ,-70) anchor(top) coloured("blue")
Endif
////Plotting
if monthMaxReached then
drawtext("Month Max Reached", 0 ,-90) anchor(top) coloured("red")
else
drawtext("Month Max NOT Reached", 0 ,-90) anchor(top) coloured("red")
Endif
return