Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

emini rth close

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

    emini rth close

    Code:
    int barsAgo = CurrentBar - Bars.GetBar(new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 9, 30, 0));
    above gets my the open for today

    how can i get the close for yesterday at 1600??

    int barsAgo = CurrentBar[1] - Bars.GetBar(new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 16, 00, 0)); // doesnt compile

    basically im trying to create a gapup/down strat. and priordayohl doesnt work b/c for emini those are not based on rth

    #2
    Originally posted by calhawk01 View Post
    Code:
    int barsAgo = CurrentBar - Bars.GetBar(new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 9, 30, 0));
    above gets my the open for today

    how can i get the close for yesterday at 1600??

    int barsAgo = CurrentBar[1] - Bars.GetBar(new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 16, 00, 0)); // doesnt compile

    basically im trying to create a gapup/down strat. and priordayohl doesnt work b/c for emini those are not based on rth

    Hi calhawk01,

    Try adding day bars as a second chart array.

    Add(PeriodType.Day, 1);

    Then call the secondary Close series.

    Close[1][1] or Close[1][0] depending on your settings.

    This should allow you to access the close - open gaps as far back as you like.

    Note: I believe day bars are always RTH. Check and confirm.

    RJay
    RJay
    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

    Comment


      #3
      Hello calhawk01,

      I believe you want to use "CurrentBars[1]" for this so that you can compile it.



      Code:
      int barsAgo = CurrentBars[1] - Bars.GetBar(new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 16, 00, 0));
      But I am not sure what your secondary Data Series is. Note that if you want to view the RTH Data Series and have the PriorDayOHLC values for the RTH session you can change the Data Series to use the CME US Index Futures RTH.

      Using Daily bars may also work but it depends on the Data Provider on what time they use for the their Daily Data. For example Kinetick uses ETH but CQG will use RTH.

      Happy to be of further assistance.
      JCNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kujista, Today, 06:23 AM
      3 responses
      6 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by Mindset, Yesterday, 02:04 AM
      2 responses
      17 views
      0 likes
      Last Post NinjaTrader_RyanS  
      Started by f.saeidi, Today, 08:03 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by samish18, 04-17-2024, 08:57 AM
      15 responses
      52 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by f.saeidi, Today, 08:13 AM
      0 responses
      1 view
      0 likes
      Last Post f.saeidi  
      Working...
      X