Recurring Vertical Lines – datetolastbarindex
Forums › ProRealTime English forum › ProBuilder support › Recurring Vertical Lines – datetolastbarindex
- This topic has 40 replies, 2 voices, and was last updated 9 months ago by inverse.
-
-
09/23/2021 at 1:52 AM #178137
So all was going swimmingly until an outage yesterday (ASX Cash timeframe) with PRT and since then we’re now capped to something close to ~30k bars in 1sec int Australia Cash 200., could be lingering outage issues, housekeeping. The DAX30(now 40) however seems worse for wear. Was a rock before then.
It looks to only be affecting 1sec ints. and duplicating another chart from another period, say 5min, will recreate the charts correctly when 1sec is selected however shortly afterwards it redraws to ~30k bars – this is with or w/o the indicator applied.
06/06/2022 at 4:56 AM #19474406/06/2022 at 9:43 AM #194752There you go:
1234defparam drawonlastbaronly = truedrawvline(datetobarindex(20220606110000))Coloured (105,105,105)style(dottedline,1)drawtext("My Text",datetobarindex(20220606110000),high)Coloured (105,105,105)return1 user thanked author for this post.
06/06/2022 at 11:20 AM #194772Hey Rob ….
I must be going sideways on this one, this is what I had below but it was spitting the dummy.
I’ll look closer and see what the go is.
drawtext(“SGX”,datetobarindex(20220606110000))Coloured (105,105,105)style(dottedline,1)
Many thanks for the speedy reply … 🙂
edit: lol, dotted line ref. ….. one of those days. Thanks for setting me straight.
06/30/2022 at 11:46 PM #196499Hi Team,
I’ve put together something with Rob’s help over the journey that’ll plot open times and label them. Many thanks for this.
Been great for the past few weeks till the other day where it started to flag an error, complaining about date format.
I shrunk the days to 1 and it’s still having a problem.
Very much a newb here with this and thanks for your patience with me.
Rgds,
INV
Lines and MTimes123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166defparam drawonlastbaronly=truedefparam calculateonlastbars=100////////Label offsets////voffset=10+closevoffset1=20+closevoffset2=40+close////////Time1 = 070000Time2 = 095000Time3 = 100000Time4 = 110000Time5 = 113000Time6 = 150000Time7 = 160000//////Label Time////////////Time8 = 070000Time9 = 093000Time10 = 101500Time11 = 101500Time12 = 111500Time13 = 115000Time14 = 152000Time15 = 162000Time16 = 162000Time17 = 162500////NumberOfDays = 1Time1 = max(0,min(235959,Time1))Time2 = max(0,min(235959,Time2))Time3 = max(0,min(235959,Time3))Time4 = max(0,min(235959,Time4))Time5 = max(0,min(235959,Time5))Time6 = max(0,min(235959,Time6))Time7 = max(0,min(235959,Time7))//Time9 = max(0,min(235959,Time9))Time10 = max(0,min(235959,Time10))Time11 = max(0,min(235959,Time11))Time12 = max(0,min(235959,Time12))Time13 = max(0,min(235959,Time13))Time14 = max(0,min(235959,Time14))Time15 = max(0,min(235959,Time15))Time16 = max(0,min(235959,Time16))Time17 = max(0,min(235959,Time17))//NumberOfDays = max(0,min(999,NumberOfDays))MyDD = DayMyMM = MonthMyYY = Year//DayCount = NumberOfDaysWhile DayCount > 0 DO//// make sure it’s the same number of digits for days < 10If MyDD < 10 ThenMyDate = (MyYY * 10000) + (MyMM * 1000) + MyDDElseMyDate = (MyYY * 10000) + (MyMM * 100) + MyDDEndif// last step, add hoursa = (MyDate * 1000000) + Time1b = (MyDate * 1000000) + Time2c = (MyDate * 1000000) + Time3d = (MyDate * 1000000) + Time4e = (MyDate * 1000000) + Time5f = (MyDate * 1000000) + Time6g = (MyDate * 1000000) + Time7//// plot the lines//drawvline(datetobarindex(a))Coloured (105,105,105)style(dottedline,1)drawvline(datetobarindex(b))Coloured (105,105,105)style(dottedline,1)drawvline(datetobarindex(c))Coloured (105,105,105)style(dottedline,1)drawvline(datetobarindex(d))Coloured (105,105,105)style(dottedline,1)drawvline(datetobarindex(e))Coloured (105,105,105)style(dottedline,1)drawvline(datetobarindex(f))Coloured (105,105,105)style(dottedline,1)drawvline(datetobarindex(g))Coloured (105,105,105)style(dottedline,1)//////// draw the lables in - removed//////x = (MyDate * 1000000) + Time9//i = (MyDate * 1000000) + Time10//j = (MyDate * 1000000) + Time11//k = (MyDate * 1000000) + Time12//l = (MyDate * 1000000) + Time13//m = (MyDate * 1000000) + Time14//n = (MyDate * 1000000) + Time15//o = (MyDate * 1000000) + Time16//p = (MyDate * 1000000) + Time17////////drawtext("SPI",datetobarindex(x),voffset1,SansSerif,standard,14)Coloured (000,100,000)//drawtext("TSE",datetobarindex(i),voffset,SansSerif,standard,14)Coloured (000,100,000)//drawtext("ASX",datetobarindex(j),voffset1,SansSerif,standard,14)Coloured (000,100,000)//drawtext("SGX",datetobarindex(k),voffset,SansSerif,standard,14)Coloured (000,100,000)//drawtext("SSE",datetobarindex(l),voffset,SansSerif,standard,14)Coloured (000,100,000)//drawtext("SSE",datetobarindex(m),voffset,SansSerif,standard,14)Coloured (000,100,000)//drawtext("FDAX",datetobarindex(n),voffset,SansSerif,standard,14)Coloured (000,100,000)//drawtext("FTEU",datetobarindex(o),voffset1,SansSerif,standard,14)Coloured (000,100,000)//drawtext("ASXCL",datetobarindex(p),voffset2,SansSerif,standard,14)Coloured (000,100,000)//////// get ready to build tomorrow’s date, if needed//// compute tomorrow’s date (could be a new month, even a new year)//// 1. compute the last day of the monthLastDay = 31// 2. it’s max 30 on a few monthsIf MyMM = 4 or MyMM = 6 or MyMM = 9 or MyMM = 11 ThenLastDay = 30Endif// 3. it’s max 28 days in February, 29 on a leap yearIf MyMM = 2 ThenLastDay = 28If Year MOD 4 = 0 ThenIf Year MOD 100 = 0 ThenIf Year MOD 400 = 0 ThenLastDay = 29EndifElseLastDay = 29EndifEndifEndif//MyDD = MyDD + 1// 4. if it’s greater than LastDay it’s the next monthIf MyDD > LastDay ThenMyDD = 1MyMM = MyMM + 1// 5. if it’s greater than 12 it’s a new yearIf MyMM > 12 ThenMyMM = MyMM - 12MyYY = MyYY + 1EndifEndif//DayCount = DayCount - 1 //one day has been plottedWendRETURN07/01/2022 at 12:10 AM #19650207/01/2022 at 12:52 AM #196503Resolved maybe.12345678910111213141516171819//now working// make sure it’s the same number of digits for days < 10 (as per Robs layout)If MyDD < 0 ThenMyDate = (MyYY * 10000) + (MyMM * 1000) + MyDDElseMyDate = (MyYY * 10000) + (MyMM * 100) + MyDDEndifvs//non-working but was// make sure it’s the same number of digits for days < 10If MyDD < 10 ThenMyDate = (MyYY * 10000) + (MyMM * 1000) + MyDDElseMyDate = (MyYY * 10000) + (MyMM * 100) + MyDDEndifNot sure what happened here tbh, will have a closer look but this is usually set and forget.
Even backups confirm it was <10, so,
<10
went
<0
for a fix?
Really confused atmo .. lol
Will see how the day rolls up.
07/01/2022 at 2:22 AM #19650407/01/2022 at 10:02 PM #19657202/17/2024 at 11:12 AM #228334Hi Team,
Roberto helped out quite a bit with our smaller tf and all is well on that front.
On the
I’m wondering if there’s a way to work with a historical anchor (or any date) and add a series of calendar days to the anchor.
Ideally the both anchor and days added would be variable but I could work with static added days but a flexible anchor would be the minimum.
From what I’ve seen there can be problems with increasing the anchor variable past 31 days (32) and the indicator can error.
These days plus anchor day (dates) would be represented as v-lines on a daily chart.
eg: 20231030 as an anchor
plus 10 days
plus 12 days
plus 15 days
plus 22 days
For the life of me I can work with the smaller TF kind of ok, minutes w/in a s session for example but on the larger TF, day for example, I can’t seen to get my head around it.
Any help would be appreciated.
Cheers,
inv
02/17/2024 at 12:34 PM #228338Anchor Dates and Days Added123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138defparam drawonlastbaronly=truedrawvline(datetobarindex(MyDate1))style(dottedline,2)drawvline(datetobarindex(MyDate2))style(dottedline,2)drawvline(datetobarindex(MyDate3))style(dottedline,2)drawvline(datetobarindex(MyDate4))style(dottedline,2)drawvline(datetobarindex(MyDate5))style(dottedline,2)drawvline(datetobarindex(MyDate6))style(dottedline,2)//MyDateA = (MyDate1) + (Day1)MyDateB = (MyDate2) + (Day1)MyDateC = (MyDate3) + (Day1)MyDateD = (MyDate4) + (Day1)MyDateE = (MyDate5) + (Day1)MyDateF = (MyDate6) + (Day1)drawvline(datetobarindex(MyDateA))style(dottedline,2)drawvline(datetobarindex(MyDateB))style(dottedline,2)drawvline(datetobarindex(MyDateC))style(dottedline,2)drawvline(datetobarindex(MyDateD))style(dottedline,2)drawvline(datetobarindex(MyDateE))style(dottedline,2)drawvline(datetobarindex(MyDateF))style(dottedline,2)drawvline(datetobarindex(Day1))style(dottedline,2)drawvline(datetobarindex(Day10))style(dottedline,2)drawvline(datetobarindex(Day12))style(dottedline,2)drawvline(datetobarindex(Day15))style(dottedline,2)drawvline(datetobarindex(Day22))style(dottedline,2)drawvline(datetobarindex(Day30))style(dottedline,2)DayA = (Day1)DayB = (Day10)DayC = (Day12)DayD = (Day15)DayE = (Day22)DayF = (Day30)drawvline(datetobarindex(DayA))style(dottedline,2)drawvline(datetobarindex(DayB))style(dottedline,2)drawvline(datetobarindex(DayC))style(dottedline,2)drawvline(datetobarindex(DayD))style(dottedline,2)drawvline(datetobarindex(DayE))style(dottedline,2)drawvline(datetobarindex(DayF))style(dottedline,2)Time1 = max(0,min(235959,Time1))Time2 = max(0,min(235959,Time2))Time3 = max(0,min(235959,Time3))Time4 = max(0,min(235959,Time4))Time5 = max(0,min(235959,Time5))// last step, add hoursa = (MyDate * 1000000) + Time1b = (MyDate * 1000000) + Time2c = (MyDate * 1000000) + Time3d = (MyDate * 1000000) + Time4e = (MyDate * 1000000) + Time5//NumberOfDays = max(0,min(999,NumberOfDays))MyDD = DayMyMM = MonthMyYY = Year//DayCount = NumberOfDaysWhile DayCount > 0 DO//// make sure it’s the same number of digits for days < 10//If MyDD < 10 Then //was 10 but needed to go to 0//If MyDD < 00 ThenMyDate = (MyYY * 10000) + (MyMM * 1000) + MyDDElseMyDate = (MyYY * 10000) + (MyMM * 100) + MyDDEndif// last step, add hoursa = (MyDate * 1000000) + Day1b = (MyDate * 1000000) + Day10c = (MyDate * 1000000) + Time3d = (MyDate * 1000000) + Time4e = (MyDate * 1000000) + Time5// 1. compute the last day of the monthLastDay = 31// 2. it’s max 30 on a few monthsIf MyMM = 4 or MyMM = 6 or MyMM = 9 or MyMM = 11 ThenLastDay = 30Endif// 3. it’s max 28 days in February, 29 on a leap yearIf MyMM = 2 ThenLastDay = 28If Year MOD 4 = 0 ThenIf Year MOD 100 = 0 ThenIf Year MOD 400 = 0 ThenLastDay = 29EndifElseLastDay = 29EndifEndifEndif//MyDD = MyDD + 1// 4. if it’s greater than LastDay it’s the next monthIf MyDD > LastDay ThenMyDD = 1MyMM = MyMM + 1// 5. if it’s greater than 12 it’s a new yearIf MyMM > 12 ThenMyMM = MyMM - 12MyYY = MyYY + 1EndifEndif//DayCount = DayCount - 1 //one day has been plottedwendreturnWork in progress.
itf is attached as a semi-hacked rev, probably 1/3rd of the way there maybe.
Assistance appreciated.
02/17/2024 at 1:55 PM #228343123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145defparam drawonlastbaronly=truedrawvline(datetobarindex(MyDate1))style(dottedline,2)MyDateA = (MyDate1)MyDateB = (MyDate1) + (Day1)MyDateC = (MyDate1) + (Day2)MyDateD = (MyDate1) + (Day3)MyDateE = (MyDate1) + (Day4)MyDateF = (MyDate1) + (Day5)MyDateG = (MyDate1) + (Day6)drawvline(datetobarindex(MyDateA))style(dottedline,2)drawvline(datetobarindex(MyDateB))style(dottedline,2)drawvline(datetobarindex(MyDateC))style(dottedline,2)drawvline(datetobarindex(MyDateD))style(dottedline,2)drawvline(datetobarindex(MyDateE))style(dottedline,2)drawvline(datetobarindex(MyDateF))style(dottedline,2)drawvline(datetobarindex(MyDateG))style(dottedline,2)drawvline(datetobarindex(Day1))style(dottedline,2)drawvline(datetobarindex(Day2))style(dottedline,2)drawvline(datetobarindex(Day3))style(dottedline,2)drawvline(datetobarindex(Day4))style(dottedline,2)drawvline(datetobarindex(Day5))style(dottedline,2)drawvline(datetobarindex(Day6))style(dottedline,2)DayA = (Day1)DayB = (Day2)DayC = (Day3)DayD = (Day4)DayE = (Day5)DayF = (Day6)drawvline(datetobarindex(DayA))style(dottedline,2)drawvline(datetobarindex(DayB))style(dottedline,2)drawvline(datetobarindex(DayC))style(dottedline,2)drawvline(datetobarindex(DayD))style(dottedline,2)drawvline(datetobarindex(DayE))style(dottedline,2)drawvline(datetobarindex(DayF))style(dottedline,2)Time1 = max(0,min(235959,Time1))Time2 = max(0,min(235959,Time2))Time3 = max(0,min(235959,Time3))Time4 = max(0,min(235959,Time4))Time5 = max(0,min(235959,Time5))Time6 = max(0,min(235959,Time6))// last step, add hoursa = (MyDate * 1000000) + Time1b = (MyDate * 1000000) + Time2c = (MyDate * 1000000) + Time3d = (MyDate * 1000000) + Time4e = (MyDate * 1000000) + Time5f = (MyDate * 1000000) + Time6//NumberOfDays = max(0,min(999,NumberOfDays))MyDD = DayMyMM = MonthMyYY = Year//DayCount = NumberOfDaysWhile DayCount > 0 DO//// make sure it’s the same number of digits for days < 10//If MyDD < 10 Then //was 10 but needed to go to 0//If MyDD < 00 ThenMyDate = (MyYY * 10000) + (MyMM * 1000) + MyDDElseMyDate = (MyYY * 10000) + (MyMM * 100) + MyDDEndif// last step, add hoursa = (MyDate * 1000000) + Day1b = (MyDate * 1000000) + Day2c = (MyDate * 1000000) + Day3d = (MyDate * 1000000) + Day4e = (MyDate * 1000000) + Day5f = (MyDate * 1000000) + Day6// 1. compute the last day of the monthLastDay = 31// 2. it’s max 30 on a few monthsIf MyMM = 4 or MyMM = 6 or MyMM = 9 or MyMM = 11 ThenLastDay = 30Endif// 3. it’s max 28 days in February, 29 on a leap yearIf MyMM = 2 ThenLastDay = 28If Year MOD 4 = 0 ThenIf Year MOD 100 = 0 ThenIf Year MOD 400 = 0 ThenLastDay = 29EndifElseLastDay = 29EndifEndifEndif//MyDD = MyDD + 1// 4. if it’s greater than LastDay it’s the next monthIf MyDD > LastDay ThenMyDD = 1MyMM = MyMM + 1// 5. if it’s greater than 12 it’s a new yearIf MyMM > 12 ThenMyMM = MyMM - 12MyYY = MyYY + 1EndifEndif//DayCount = DayCount - 1 //one day has been plottedwendreturnWork in progress and now need to work on as the integers rise and we hit a month with days more than it has triggering an error.
02/17/2024 at 1:59 PM #22834502/18/2024 at 10:49 AM #2283611234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192defparam drawonlastbaronly=true// number of days ahead for each dateNumberOfDays = 1 // Change this value to adjust the number of days ahead// Calculate subsequent datesMyDateA = MyDate1 + NumberOfDaysMyDateB = MyDate1 + (3 * NumberOfDays)MyDateC = MyDate1 + (7 * NumberOfDays)MyDateD = MyDate1 + (11 * NumberOfDays)MyDateE = MyDate1 + (16 * NumberOfDays)MyDateF = MyDate1 + (21 * NumberOfDays)//drawvline(datetobarindex(MyDateA))style(dottedline,2)coloured("red")drawvline(datetobarindex(MyDateB))style(dottedline,2)coloured("red")drawvline(datetobarindex(MyDateC))style(dottedline,2)coloured("red")drawvline(datetobarindex(MyDateD))style(dottedline,2)coloured("red")drawvline(datetobarindex(MyDateE))style(dottedline,2)coloured("red")drawvline(datetobarindex(MyDateF))style(dottedline,2)coloured("red")NumberOfDays = max(0,min(999,NumberOfDays))MyDD = DayMyMM = MonthMyYY = Year//DayCount = NumberOfDaysWhile DayCount > 0 DO//// make sure it’s the same number of digits for days < 10//If MyDD < 10 Then //was 10 but needed to go to 0//If MyDD < 00 ThenMyDate = (MyYY * 10000) + (MyMM * 1000) + MyDDElseMyDate = (MyYY * 10000) + (MyMM * 100) + MyDDEndif// 1. compute the last day of the monthLastDay = 31// 2. it’s max 30 on a few monthsIf MyMM = 4 or MyMM = 6 or MyMM = 9 or MyMM = 11 ThenLastDay = 30Endif// 3. it’s max 28 days in February, 29 on a leap yearIf MyMM = 2 ThenLastDay = 28If Year MOD 4 = 0 ThenIf Year MOD 100 = 0 ThenIf Year MOD 400 = 0 ThenLastDay = 29EndifElseLastDay = 29EndifEndifEndif//MyDD = MyDD + 1// 4. if it’s greater than LastDay it’s the next monthIf MyDD > LastDay ThenMyDD = 1MyMM = MyMM + 1// 5. if it’s greater than 12 it’s a new yearIf MyMM > 12 ThenMyMM = MyMM - 12MyYY = MyYY + 1EndifEndif//DayCount = DayCount - 1 //one day has been plottedwendreturnEnded up here but still cant roll past the month barrier. So it’ll plot w/in a month but not beyond …
02/18/2024 at 10:57 AM #2283621234// Define the anchor date (MyDate1), month (MyMM), and year (MyYY)MyDate1 = 20231001 // Assign the anchor dateMyMM = 10 // Assign the monthMyYY = 23 // Assign the yearMyDate1 defined as a ext variable so you can plug it in via GUI and not w/in code but to be honest is easy enough to do it via cli.
-
AuthorPosts
Find exclusive trading pro-tools on