Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

60 Instrument Test

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

    #16
    strategy bug test

    Originally posted by Josh View Post
    For your custom bars you can definitely make your own. Please check out the Heiken Ashi indicator. That one builds its own bars for display.

    Do you have a simple as possible strategy to correspond with the screenshots? Thanks.
    That would be great if we can build custom bars. Will check it out.

    Find attached "TestStrFiles.zip" = test strategy bug files, which defines a bare bones strategy and indicator based on an Added instrument.

    Instructions:

    - Load the NinjaScript files

    - Add the TestStrBug Strategy to a 15-second ER2 09-08 chart with a session time of regular US trading hours (or any other 15 second bar chart with adequate data).

    - One of two things will happen, either,
    (a) the added indicator and its panel won't display (that's one bug), or
    (b) the indicator appears, but displays the Added instrument (DJIA) incorrectly, with flat line segments corresponding to 1 minute closes (the second bug)

    - In either case, the bug can be fixed by "Reload NinjaScript".

    - If you can't get the indicator to display when the strategy is first loaded, add a dummy ConstantLines indicator first with Autoscale = false. That will allow you to see the second bug that distorts price display.

    Thanks for looking into this. When I've gotten a little further along with my own stuff, I'll post some tips for working with multi-instrument strategies (from the perspective of someone who is using them more as multi-instrument indicators).
    Attached Files

    Comment


      #17
      This line here: Add("^DJIA", BarsPeriod.Id, BarsPeriod.Value);

      Have you tried just hardcoding those BarsPeriod values?
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        Originally posted by Josh View Post
        This line here: Add("^DJIA", BarsPeriod.Id, BarsPeriod.Value);

        Have you tried just hardcoding those BarsPeriod values?
        If the BarsPeriod ref.s didn't work, I guess that would be a bug too.

        I'll give it a try, but idea is to make indicator track primary instrument, without hardcoding these values.

        Comment


          #19
          Likely will not work since "Bars" may or may not hold a value in Initialize().
          RayNinjaTrader Customer Service

          Comment


            #20
            resolution/recommendation

            Originally posted by NinjaTrader_Ray View Post
            Likely will not work since "Bars" may or may not hold a value in Initialize().
            Good. I'm glad the "bug" was so easily found, and makes sense.

            I can see how one can get into trouble doing the "Add" from within an override to the Strategy's own Initialization routine. Couple of things:

            - The doc.s should warn/inform about what is or isn't available as a property of the Strategy when the Initialization override is called. (Or change how it's being done to make this documentation unnecessary.)

            - It seems reasonable that one would want to write bar length-independent strategies and indicators, so the primary bar Id and Value should be available for use with "Add", one way or another.

            Anyway, thanks again for pursuing this issue. For what I'm doing, the only remaining "bugs" (vs. "features") I'm currently aware of are related to historical data loading, and one case where a Backup failed and trashed stuff. The latter is addressed by doing Backups after any session where a lot of changes have been made.

            The 2 historical data loading problems I have are (1) poor performance under certain conditions (described in a previous thread), and (2) about 1 in 20 times, reloading the NinjaScript for a Strategy will result in NT getting stuck when reloading price data for the first Added instrument (i.e., it just grinds away forever, as if caught in a loop). The latter, however, might be tied to the above Initialization problem, so will keep an eye on it.
            Last edited by greentrader; 07-20-2008, 10:13 PM.

            Comment


              #21
              It's not a bug, its by design since there are times that Initialize() can be called when a Bars object is not present. Here is what we suggest from our Help Guide.

              Additional Access Information
              This property can be accessed without a null reference check in the OnBarUpdate() event handler. When the OnBarUpdate() event is triggered, there will always be a Bar object which holds the Period property. Should you wish to access this property elsewhere, check for null reference first. e.g. if (Bars != null)
              RayNinjaTrader Customer Service

              Comment


                #22
                thanks to all

                Yes, it's a "feature", not a "bug"...

                BTW, "BarsPeriod", the object I was accessing, is missing the above "Additional Access Information" note, and is accessed as a property of the Strategy object (this.BarsPeriod). However, the pop-up note about BarsPeriod says, "Gets the period for the primary Bars object of the strategy" which would have led me back to the "Bars" object if I had noticed that... Lesson learned!

                Anyway, I stand by my recommendations: Fix the doc.s, or fix the code, to remove any ambiguity, and make the period Id and Value available for use when Adding instruments, one way or another.

                Thanks again to everyone for their time and patience.

                Comment


                  #23
                  Removed some posts, since I got confused ... your findings are accurate.

                  Comment

                  Latest Posts

                  Collapse

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