Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trading Days vs Calendar days

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

    Trading Days vs Calendar days

    I want to be able to build an average of the last 2 trading days on a chart but I need to know when the start of 2 trading days ago was, preferably when I am receiving the bars as opposed to processing the bars backwards after the chart is completed to get the data. I can do it right to left but am hoping to process it left to right, drawing previous line plots is no fun.

    At the start of an indicator what is the best way to determine 2 trading days back? I want to pre-process the bar data before the indicator starts receiving bar data.

    I tried Bars.GetDayBar(2) but if the chart has not already built that past data I get a null. Right now I am using calendar days back from current date time to know when to start but this method is not perfect.

    #2
    Hi ct, thanks for the post. There isn't really a decidated function available here for trading days access, it would be Calendar based using the typical DateTime functions and then weekends / holidays would need to be figured in (holiday management is something on our lists for the next major platform upgrade). For the calcs you would need to work in OnBarUpdate() then and wait until you had two days of data seen to be able to calculate a meaningful average price for the last 2 sessions.

    Comment


      #3
      Bertrand

      Many thanks for the reply. I didn't know if there was some slick way to do it I didn't know about. I can do it the hard way, done it before.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      174 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      328 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      252 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      355 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      181 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X