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

Needing to run a strategy on every bar?

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

    Needing to run a strategy on every bar?

    Hi there,

    This could be such a silly question, one which I may have not have thought through enough.

    If you run a strategy on historical data.

    And the strategy calls an indicator at lets say 15:00pm only.

    But that indicator has to run its own OnBarUpdate every tick from 08:00am to 15:00pm to have the value correct for when the strategy calls it.

    Does that strategy need to run OnBarUpdate() on every single bar up until 15:00pm for that indictor to have all the data it needs or can the OnBarUpdate of the strategy simply be returned on every iteration until it gets to 15:00pm where it can finally go head and call the indicator?

    Does that make sense?

    I am asking because I only ever look for trades after 14:45pm and so when I'm running my strategy on historical data, I just want the strategy to return;. But I need the indicators to know what happened before 14:45 if that makes sense.

    Cheers.

    Tarik

    #2
    Hi Tarik, thanks for posting. The strategy hosting the indicators will keep them updated even if you return from OnBarUpdate. It can be tested by using Print() within the strategy to print out the data and return. e.g. print out the indicator's value in OnBarUpdate to see its value.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hey Chris,

      Ahh amazing I will give that a go but that helps a lot thanks,

      Tarik

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by nleitman, Today, 11:46 AM
      7 responses
      18 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by cmtjoancolmenero, Today, 01:09 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by DanielRaz, Today, 12:54 PM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Russ Moreland, 04-24-2024, 12:54 PM
      2 responses
      18 views
      0 likes
      Last Post JosephDavidsona  
      Started by truepenny, Today, 03:45 AM
      5 responses
      27 views
      0 likes
      Last Post NinjaTrader_RyanS  
      Working...
      X