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

OnBarClose > Current bar open

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

    OnBarClose > Current bar open

    Hi NT & NinjaScript Experts,

    I am using the "OnBarClose" calculation type, on on strategy across daily bars for about 26 products.

    However, I want to retrieve the Open of the currenty active bar.
    Is the Open price available to call upon ?
    Or can I only access Open[0], which is now the previous bar?

    I have an IF statement that wants to run logic based on the current bar's opening value.
    Unfortunately, its it stands, Open[0] will give me the open of the previous bar.

    I would prefer not to use "OnTickChange/OnPriceChange" calculation type, due to the extra processing required, and I think it seems slightly overkill to change the calc type do simply retreive the open of the currently active bar once per day.

    Any ideas? Please advise

    Thank you
    A

    #2
    Hello aavevo,

    Thanks for your post.

    You would need to change to Calculate.OnEachTick or Calculate.OnPriceChange in order to shift your references such that bar index 0 points to the currently forming bar. You can segment your code to only run once per bar or on each tick, as needed. Please see the working example here: http://ninjatrader.com/support/forum...ad.php?t=19387
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you - had not thought of segmenting the code

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by WHICKED, Today, 12:45 PM
      2 responses
      16 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by GussJ, 03-04-2020, 03:11 PM
      15 responses
      3,272 views
      0 likes
      Last Post xiinteractive  
      Started by Tim-c, Today, 02:10 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Taddypole, Today, 02:47 PM
      0 responses
      2 views
      0 likes
      Last Post Taddypole  
      Started by chbruno, 04-24-2024, 04:10 PM
      4 responses
      51 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Working...
      X