Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Corollary to OnBarUpdate?

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

    Corollary to OnBarUpdate?

    Is there a method that runs when OnBarUpdate is not running?

    Suppose I have a single time frame, single instrument strategy. Say the bars are 30 minutes. As I understand, at each new bar (so, every 30 minutes), OnBarUpdate is invoked, and my strategy runs the bulk of the algorithm.

    I want to run something in the strategy between each OnBarUpdate between bars. Instead of OnBarUpdate => Downtime => OnBarUpdate => Downtime, I want to do OnBarUpdate => OtherProcessing => OnBarUpdate => OtherProcessing, etc.

    It would be nice if there was a NotOnBarUpdate, or some method that is automatically invoked when OnBarUpdate is not going to be invoked.

    Does this make sense? Poking around in the documentation has methods for multiple time frames. I could do something like this, but it feels like more of a hack. Moreover, I would prefer to run the in-between processing asynchronously, and not necessarily on a period faster than my Input bars.

    Thanks!

    #2
    It sounds as if you are looking for the advanced event driven programming methods, or you could just use another data series at a faster time frame.

    ref: http://www.ninjatrader.com/support/h...n_program2.htm

    Comment


      #3
      Hello,

      Thanks for your forum post.

      We did not design NinjaTrader to operate this way as we did not see the benefit from it not sure of the advantages of doing this or why this would need to be done or most likely their exists an alternate programming method that would fit into the OnBarUpdate() methodology. However you do have another option.if you do not want to use OnBarUpdate(). You can use the following to do some processing on a standard set schedule using a timer.



      If this will not work for you let me know and I will put a recomendation into development on this for you.

      Let me know if I can be of further assistance.
      BrettNinjaTrader Product Management

      Comment


        #4
        Originally posted by Serac View Post
        Is there a method that runs when OnBarUpdate is not running?

        Suppose I have a single time frame, single instrument strategy. Say the bars are 30 minutes. As I understand, at each new bar (so, every 30 minutes), OnBarUpdate is invoked, and my strategy runs the bulk of the algorithm.


        Thanks!
        Not sure exactly what you are looking for.

        If you are working with 30 minutes bars and want to perform some processing before the 30 minute bar is complete then set CalculateOnBarClose = false. This will force processing for each incoming tick inside a 30 minute bar. You will then need to rework your logic to do the bulk of the processing when the 30 minute bar is complete by checking for the First Tick of the new 30 minute bar.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmoran13, Yesterday, 01:02 PM
        0 responses
        29 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        21 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        160 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        95 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        148 views
        2 likes
        Last Post CaptainJack  
        Working...
        X