Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Execute code regardless of trading volume?

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

    Execute code regardless of trading volume?

    Hi all, I'm a complete NinjaTrader noob and I've quickly run into a problem. As I understand it, OnBarUpdate is only executed if there has been some trading volume over the previous minute. However, I want my strategy code to be executed once every minute regardless of whether there was any trading volume for the current stock over the previous minute, but I can't. If my understanding is correct, isn't this a significant limitation of NinjaTrader?

    If I am correct, here are a couple basic things that would be impossible:
    • Buy a thinly-traded stock at 1pm every day... We can't do this because there is no way to ensure there will be any trading volume during the minute starting at 12:59pm, and if there isn't, OnBarUpdate would not be called at 1pm, and hence the trade not executed.
    • Buy a thinly-traded stock 1 minute after some condition occurs (say an EMA crossover)... We can't do this because there is no way to ensure there will be any trading volume during the minute after the condition occurs, and if there isn't, OnBarUpdate would not be called. (Of course I'm not implying this would be smart to do; it's just a simple example).

    Any thoughts? Thanks...

    #2
    Use a Timer event.

    Comment


      #3
      Interesting, thanks... A few follow-up questions:

      1. Are you sure Timer events can be used specifically to execute orders in NinjaTrader? It just seems odd that this isn't part of NinjaTrader's native functionality.

      2. Timer events would not work when backtesting (in the Strategy Analyzer) since they use actual elapsed time, correct?

      3. What if I wanted to program some type of filter, say an EMA, that is updated every minute regardless of trading volume. It seems like using event timers to do this would get extremely convoluted, no? It would be so much easier if NinjaTrader would have an option to force OnBarUpdate to be called every bar (i.e. every minute).

      Comment


        #4
        DartMonkey, they can be used in NT - we have a TriggerCustomEvent example uploaded here - http://www.ninjatrader.com/support/f...ead.php?t=5965

        You are correct about the backtest and understanding our framework is event based, so if you see no tick coming in then time alone would not dictate creation of a new bar and therefore OnBarUpdate() being called.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        573 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        575 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X