Announcement

Collapse
No announcement yet.

lookup bar index?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • lookup bar index?

    Is there any way to lookup a bar index given a date and time?

    For instance I need to draw a line between the current bar (0) and back to a known date/time bar, but how does one determine the bar index? Or I need to lookup price for a known date/time.

    As my script is called what do I need to do to record any interesting or critical data points? I.e. I can't record the bar index since it changes with every new bar.

    Thanks,
    Mike

  • #2
    Record the bar count when the historical point occurs by using histBarCount = getCurrentBarCount(). Then, to refer to the historical point in terms of barIndex, subtract the present barcount from the historical barcount to get the relative barIndex, e.g. relBarIndex = histBarCount - getCurrentBarCount()

    Comment


    • #3
      Thanks!

      Comment


      • #4
        You are most welcome.

        Comment

        Working...
        X