Recurring Vertical Lines – datetolastbarindex

Forums ProRealTime English forum ProBuilder support Recurring Vertical Lines – datetolastbarindex

Viewing 11 posts - 31 through 41 (of 41 total)
  • #228380

    Importing the attached ITF file will spare you from having to add variables.

    Sorry to be a pain Rob, I’ve hit a wall of sorts and it looks similar to the ITF you kindly provided back in the day (it too hits the same wall when plotting past the end of the old month and into a new month). Not posting this as a bump because I know you have your hands full more so to say there’s a bit of consistency here and it could be a simple one for your IP.

    I can plot lines half a dozen different ways (just about) and they work well w/in a given month, it’s only when you lean into the next months plot(s) that it falls over.

     

    I’ve even peeled out the last day of the month compute and it has no effect, so I’m guessing in there is the solution vs DayCount cfg perhaps.

     

    I know the dates are in numeric format and the ‘additional days’ are in integer form but I’ve not been able to push by what appears to be a hard limit (for me). Probably my lack of IP … !

     

    Below is a basic setup that manifests in the same way as the previously linked ITF. Just pushout the NumberOfDays variable past months end and it should break. The ITF linked a few pages back by you will also error. I feel like a bit of a dill not having picked up on it back in the day – would’ve prevented the need to revisit now but it’s now that as I’m putting together a housekeeping guide for family that I’ve come back to it. The historical ITF was extremely helpful in identifying where APAC and EU sessions influence, so many thanks for that input (was foundational for me with PRT).

    /rant

    Cheers,

     

    inv

     

     

     

     

    #228393

    This post (and the following one) https://www.prorealcode.com/topic/need-help-with-date/#post-228150  might be of some help. Still it’s not exactly what you want.

    When you have a DATE, you must:

    • decompose it into Year, Month and Day
      .
    • calculate the last day of the Month (taking into account leap years) then add the desired number of days to the Day to get a NEW date
      .
    • pack the new YY, MM and DD into a date in the format YYYYMMDD.
      .

    I coded this snippet (tested against eXcel over a few centuries, roughly 200K days, to test leap years), to add days to any starting date (it can be easily adapted to subtractions):

     

     

     

    1 user thanked author for this post.
    #228422

     

    Many thanks Rob, your feedback is appreciated!

    I’ll have a look when I get a moment, probably closer to weekend, could be sooner, kind of eager to iron this one out or shelve it if need be, yet, I’m ever hopeful it can be sorted … 🙂

    #228423

    Not bad for not having tested it Rob!

    Dropped it in a new indicator, defined a vline for ‘olddate’ and ‘newdate’ and it plotted both.

    I’ve always thought how weekend data is handled could be a problem, so I’ll POC against some manual calcs I have and see how close it marries.

    For now it looks very very good.

    #228425

     

    The above works but as you can see it’s a replication of one process to add another single plot, which I’m happy to say works well, so there’s wins here.

    Is there another way to do this without replicating large chunks I wonder?

    Needing to ‘decompose’ the anchoring date each time is the crux here (thanks for emphasizing this Rob) , so we can ‘add’ too it and create the subsequent day counts, then run though the lastday/date loop to process the plot accordingly.

    I can tweak the lastday/date loop, to ‘bundle’ all the dates and years w/in the single loop (I think) but if I wanted 30 of them, wow, I’m hoping there’s an easier way.

    I’ll have a go at it again and see if I can compress a little, no doubt it’ll be a right mess but I’ll have a go. Any words of wisdom are welcomed and appreciated.

    Cheers,

    inv

     

     

    #228439

    We can use arrays, but 2 separate indicators are needed, as the whole process need two nested loops, which returns an error:

    • MyDateCaller, is the first indicator which contains tha dates to be handled and the number of days to be added; it simply calls the second indicator passing it the two parameters (date + days)
    • DateSum, is the second indicator; it gets the two parameters, doing the required math, then returns the newDate to the caller.

    only the indicator MyDateCaller needs to be added to your chart, the other simply needs to be present in the platform, among all other indicators.

    You may add as many dates as needed as array elements in the calling indicator.

    #228451

    I don’t know what to say Rob. Thankyou. Honestly wow.

    I’ll give this a lookover, so I can do it a bit of justice.

    The current setup from, your workings, as I have tweaked it, adds days to a single date as well, as seen further on up above, my last effort, so will try that with myDateCaller, where I’ll have a series of numbers to be added to the date or dates. We count forward random day counts from a single date.

    So we’ll have say:

     

    $myDate[1]  = 20210723

    plus 3 days

    plus 12 days

    plus 20 days

    plus 27 days

    We’ll plot these days.

    It’s here where I became unglued if you will and had to create multiple DateSums equiv. but here you’re calling it to calc out.

    Yes, I think this will do nicely on that front but will I be able to handle the multiple days as above, 3, 12, 20 etc or will I need to call the days as well.

    I have a go and let you know how it goes, fingers crossed … 🙂

     

    Many thanks again.

     

     

     

    #228453

    This was the setup, pre your latest reply Rob, you can see how the wheels been re-invented a few times here!

    I think we’re headed in the right direction (your last post) and appreciate your time.

     

     

    #228465

    Replace the calling indicator MyDateCaller  with this one:

    I added an array also for the number of days to add to a date. Element 1 of the array $add2date will be added to element 1 of the array $myDate and so on…

     

    1 user thanked author for this post.
    #228480

    Thanks Rob, I’ll give this a go and see how it works.

    I was hopeful that we could cfg dates and added nbrs  via GUI, which is were you implied earlier on that this will get us to a working solution maybe minus the full GUI capability but everything’s a measure in compromise, so if I can get a workable solution it probably doesn’t matter where I plug the dates into and if the # are kind of static we can housekeep those and  we can then focus on ‘ beautification of dates ‘ once I see how it’ll impact workflows but from we are at the moment there’s been huge wins imo, so thanks again.

    #228487

     

    All works well … 🙂

     

     

    1 user thanked author for this post.
Viewing 11 posts - 31 through 41 (of 41 total)
Similar topics:

Create your free account now and post your request to benefit from the help of the community
Register or Login