Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Meaning of Message: Order was placed in incorrect 'BarsInProgress' context?

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

    Meaning of Message: Order was placed in incorrect 'BarsInProgress' context?

    Hi,

    In a MultiTimeFrame strategy I get several messages:

    Order for strategy 'MyStrategy' was placed in incorrect 'BarsInProgress' context. Order ignored.

    What does this mean (when exactly does this happen) and how can I avoid it?



    2nd Problem: in the same MultiTimeFrame Strategy trades are executed, but they don't show up in the Chart tab of the Strategy Analyzer (the Bars and Indicators do, but not the trade Entry and Exit signals). I don't understand ...

    Amendment in Edit: With a different timeframe settings (50 Tick bars for primary, and 1 Tick for BarsArray[1] time series), the trades DID show up on the chart. So sometimes they do, sometimes they don't ... (but both timesIhave manytrades in the Trades/Executions and Orders tabs).



    TIA,

    Peter




    #2
    imported post

    1) This means that you are calling an Enter() method on the supplemental bar series added to your strategy.

    You can only call an Enter() or Exit() method on the primary series which is

    if (BarsInProgress == 0)
    {
    // Place order here
    }

    2) See above, I suspect this could be the issue or, you have disabled plotting execution in the chart properties.

    Ray


    RayNinjaTrader Customer Service

    Comment


      #3
      imported post

      Thanks, Ray, I get it:

      MEMO: The primary bar series has to be the 'shortes' time scale (in my case 1 Tick). The order submission logic depends on the time scale of the PRIMARY bar series.

      For the plotting issues, I have plotting exectuion ON. See my edit (which crossed your reply, I guess).

      Again, thanks for clarification.

      Peter

      PS: It's a steep learning curve, but I'll get there .... . A few more (nontrivial and well commented) sample strategies downloadable from somewhere (maybe in a section 'Sample Strategies' in this forum) and programming examples would be *very* helpful for newbies like me. Doesn't have to be worded out nicely like in the Help Docu, just a pool of working code (no matter if profiable or not).


      Comment


        #4
        imported post

        FYI, I am continuing the discussion on the Chart issue in the Strategy Analyzer section of this forum - where it is more appropriate, I think:

        http://ninjatrader.mywowbb.com/view_...mp;forum_id=17



        cheers

        peter


        Comment


          #5
          imported post

          I still don't get it: Now my primary time series is on a 1 tick scale and I still get the same error dialog as before:

          Order for strategy 'MyStrategy' was placed in incorrect 'BarsInProgress' context. Order ignored.


          How is that possible? BarsInProgress should always be0 on a 1-tick resolution chart or am I missing something here? According to my current theory, OnBarUpdate() is called at every tick, the current bar is always closed, and the Order submissions at Entry() should always be in synch with the primary time series, which ison the 1-tick level?

          This is more difficult than I thought ...

          FYI, I attached the (trivial) script and a screenshot of the Backtest Setting window in the zip file.

          Cheers and TIA,

          Peter


          Attached Files

          Comment


            #6
            imported post

            Partially answering my own question in preceding post:

            a line:

            if
            (BarsInProgress != 0) return;

            at the beginning of the OnBarUpdate() method solves this issue. But I don't understand why. Is it that orderscan only be issued when OnBarUpdate is called for the *primary* bar series? In my case the primary and secondary bar series are for the same instrument. The doc for BarsInProgress says:

            protected override void OnBarUpdate()
            {
            // Check which Bars object is calling the OnBarUpdate() method
            if (BarsInProgress == 0)
            {
            // A value of zero represents the primary Bars which is the ES 12-06
            // 1 minute chart.
            // Do something within the context of the 1 minute Bars here

            }
            else if (BarsInProgress == 1)
            {
            // A value of 1 represents the secondary 5 minute bars added in the Initaliaze()
            // Do something within the context of the 5 minute Bars
            }
            }

            It suggest that I can issure orders just as well when BArsInProgress == 1. So I really don't quite understand when exactly I can issue orders so that they don't get ignored.

            TIA for clarification.

            Peter


            Comment


              #7
              imported post

              Now fully answering my own question (for the sake of fellow newbees reading this thread and wrestiling with similar issues):

              The doc page http://www.ninjatrader-support.com/H...struments.html DOES say:

              If you have multiple time frame Bars objects of the same instrument (as we do above since we have MSFT 1 minute on index 0 and MSFT 3 minute on index 1) you can only submit orders on the FIRST context of the instrument which is index 0 in this case.

              So, it is just an RTFM issue on my behalf.My apologies. I still don't understand why it is designed this way, but I now understand how it is supposed to work.

              For the doc writers: I read this page now probablyover 10 times and only with many trials and errorswhile programming along side I finally understand thefull concept (maybe?). I hope that in the (near?) future there will be more sample strategies available for studying and learning.

              Thanks again for the excellent support you guys give (nights and weekends).

              Cheers

              Peter


              Comment


                #8
                imported post

                Support is easy when the customer solves his own problem!

                As you know, this is our first pass so there is a lot of postive and negative things that will be uncovered as usage of our tools in this area increase. This will help us evolve the product, the documentation and reference samples.

                We will increase reference samples in time.

                Ray
                RayNinjaTrader Customer Service

                Comment


                  #9
                  imported post

                  ninjatrader wrote:
                  As you know, this is our first pass ...
                  I understand very well how software developmentworks (having done that for over 25 years in research environments).I like NT6's new capabilites *very* much and currently prefer it over competing products such as the one "right on the edge" and the "openly smart" one. I'd like to see it develop into a successful product. This is why Ispend time giving you feedback and writing lengthy reports/problems/questions on this board. I might be a 'pain', butmaybe it helps you to get a 'feel' what novice users might be wrestling with and how 'infinitely more creative' they arecompared towhat the developers had in mind.


                  Cheers and keep up the good work.

                  NT7 will be a blast !

                  Peter




                  Comment


                    #10
                    imported post

                    Thanks, I got a chuckle of your play on words...

                    Ray
                    RayNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    580 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    335 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    102 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    554 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    552 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X