hello,
I’m trying to create code that draws horizantal segment for opening each week This line extends all the week.
i want to use this indicator for low TF like 5 min or 15-30 mins…
so i want any trick to get weekly closing date to add it in DateToBarIndex(date) to expend the line of segment until weekly closing date ?
thank you,
There you go:
DEFPARAM DrawOnlastBarOnly = True
IF (OpenDayOfWeek = 1) AND (OpenDayOfWeek <> OpenDayOfWeek[1]) THEN
StartBar = BarIndex
WeekOpen = open
YY = OpenYear
MM = OpenMonth
DD = OpenDay + 7
IF DD > 31 THEN
DD = DD - 31
MM = MM + 1
IF MM > 12 THEN
MM = 1
YY = YY + 1
ENDIF
ENDIF
NextWeek = (YY * 10000) + (MM * 100) + DD
NextDate = (NextWeek * 1000000) + 235959
ENDIF
DrawSegment(StartBar,WeekOpen,DateToBarIndex(NextDate),WeekOpen)
RETURN
JSParticipant
Senior
Hello,
Do you mean something like this…?
Thank you, brother, for your effort… I guessed this way, but this way you should put many possibilities, such as if the month ends on the 28th, 29th, 30th, or 31st… I wanted something easy, such as moving to weekly and taking the time to close that candle… Is that possible?
JSParticipant
Senior
Hi,
Here is the code:
You can adjust the color, line type and thickness of the line…
TimeFrame(Weekly)
OpenWeek=Open
Return OpenWeek as "OpenWeek" Coloured("Purple") Style(DottedLine,3)