Hi All.
I have managed to code a vertical line to be appear in every 5days.. but is there a way to make this appear in every 10 days. also on the code the 10 DAYS text to be on top or the bottom of the chart. any help would be much appreciated!
Thank you in advance
//DayOfWeek = 1 //0=NO DayOfWeek 1=YES DayOfWeek
if DayOfWeek = 1 then
if Time = 010000 then
atr=averagetruerange[14]
drawtext("10DAYS",barindex+9,low-atr)coloured(112,169,161)
DRAWVLINE(barindex)coloured(112,169,161)
endif
endif
return
Not tested:
if DayOfWeek = 1 and Time = 010000 then
if not flag then
atr=averagetruerange[14]
drawtext("10DAYS",barindex+9,low-atr)coloured(112,169,161)
DRAWVLINE(barindex)coloured(112,169,161)
flag = 1
else
flag = 0
endif
endif
return
As for top and bottom of chart there is no defined top or bottom of chart as you cannot know what the maximum and minimum displayed price is to use in an indicator. It would be a nice addition to PRT to be able to retrieve a value for this as you zoom in and out but at the moment it is not possible.
Thanks very much @vonasi it works fine! 🙂
i have tried to add a boolean so i can make it appear when ever i want.. but it doesn’t seems be working, what am i doing wrong?
//DayOfWeek = 1 //0=NO DayOfWeek 1=YES DayOfWeek
if DayOfWeek = 1 and Time = 010000 then
if not flag then
atr=averagetruerange[14]
drawtext("10DAYS",barindex+9,low-atr)coloured(112,169,161)
DRAWVLINE(barindex)coloured(112,169,161)
flag = 1
else
flag = 0
endif
endif
return
It seems to be working fine. I tested it on DAX 4h.
Your Boolean is a PRT code word and returns the day of week. When you say IF DAYOFWEEK = 1 then it is checking to see that it is a Monday.
You could try this with an ONOFF boolean (not tested):
//OnOff = 1 //0 = Display Off 1 = Display On
If OnOff then
if DayOfWeek = 1 and Time = 010000 then
if not flag then
atr=averagetruerange[14]
drawtext("10DAYS",barindex+9,low-atr)coloured(112,169,161)
DRAWVLINE(barindex)coloured(112,169,161)
flag = 1
else
flag = 0
endif
endif
endif
return
Sorry, I misunderstood your question.
Thank you @Vonasi and @robertogozzi
Just noticed its has changed and it calculates from 9th DEC Monday instead of calculating 16th DEC monday??
why is this not calculationg from 16th monday.. to 10day period?
The indicator will start at the left of your chart and look for the first Monday and draw a line there. If time has passed by and your chart only shows 100k bars then the first Monday on the left of the chart will have changed and the line will be drawn on a different set of Mondays to that that it was previously drawn on. This is always going to be an issue when using weird time frames such as 10 days.
A long time ago we were all discussing a strategy based on 26 seconds and everyone was not surprisingly getting different results depending upon which second they started the strategy on!