Hi nicolas,
Please can you check below.. it doesn’t seem to work properly.. also attached a pic below what i meant!! sorry to bother you again still learning.. I really appreciate your help!!!
defparam drawonlastbaronly=true
// --- parameters
ATRperiod = 14
// ---
dTR = 0
if intradaybarindex=0 then
for i = 0 to ATRperiod
dTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1))))
next
endif
avg = dTR/ATRperiod
converted = round(avg/pointsize*10)/10
htr = Dlow(0)+avg[1]
ltr = Dhigh(0)-avg[1]
if intradaybarindex=0 then
begin=barindex
endif
drawsegment(begin,htr,barindex,htr) coloured(255,255,0)
drawsegment(begin,htr+20*pointsize,barindex,htr+20*pointsize) coloured(255,0,0)
drawtext("#htr# - (D1atr: #converted#)",barindex,htr+10*pointsize,Dialog,Bold,10) coloured(255,255,0)
drawsegment(begin,ltr,barindex,ltr) coloured(255,255,0)
drawsegment(begin,ltr-20*pointsize,barindex,ltr-20*pointsize) coloured(0,255,0)
drawtext("#ltr# - (D1atr: #converted#)",barindex,ltr-10*pointsize,Dialog,Bold,10) coloured(255,255,0)
drawsegment(begin,Dopen(0),barindex,Dopen(0)) coloured(255,250,250)
return