Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Historical Bars

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

    Historical Bars

    I am writing a strategy and would like to "look up" information on a stock in a previous time during the OnBarUpdate method.

    To accomplish this, I am first adding the stock in the Initialize method:

    Code:
    Add("MYSTOCK", PeriodType.Minute, 15);
    Then, I am attempting to look up the price of the stock 50, 15 minute "ticks" ago using:

    Code:
    var bar = CurrentBar - 50;
    var bars = BarsArray[0];
    			
    double oldPrice =  bars.GetOpen(bar);
    This seems to work ok, but it also seems to be including many "ticks" that are not during the active trading day (pre-market, post-market, weekends, etc). Is there any way to ensure that the bars I am using are ONLY from active trading hours?

    #2
    Think I found it

    I think I had the wrong template selected for my stock indicator... does that seem correct?

    Comment


      #3
      Thanks for letting us know - yes, that sounds correct - as the primary template would define the hours in most cases of the setup.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      639 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      572 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X