Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Chart not displaying when added to strategy

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

    Chart not displaying when added to strategy

    I created an indicator named CCIZLR. When I add it to a chart along with the WoodiesCCI indicator, it displays arrows where a ZLR occurs (see twoindicators.png).

    However, when I add the two indicators to a chart within my WoodiesZLR1 strategy , the arrows from CCIZLR are not displayed (see strategyaddstwoindicators.png). Any clues about what I am doing wrong?

    The code is in the attached zip file.

    Thanks,
    Jason
    Attached Files

    #2
    I suggest you first start by trying to debug via this tip: http://www.ninjatrader-support.com/v...ead.php?t=3418
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      The WoodiesCCI indicator used within my indicator (CCIZLR) does not seem to be working correctly when CCIZLR is added to my strategy.

      When I add the indicator to a chart, the debug messages display the WoodiesCCI values as expected:

      CCIZLR::OnBarUpdate - ENTER: Time: 4/21/2008 9:00:00 PM Open: 1.5912 Close: 1.5902
      CCIZLR::isZlrEntry - ENTER: Long
      CCIZLR::isTrending - ENTER: Long
      CCIZLR::isTrending - ZoneBars[0] = 2
      CCIZLR::isTrending - Sidewinder[0] = 0
      CCIZLR::isTrending - woodiesCCI[0] = -56.6978193146519

      But when I add my strategy to the chart, which in turn adds the CCIZLR indicator to the chart, the debug messages show different values:

      CCIZLR::OnBarUpdate - ENTER: Time: 4/21/2008 9:00:00 PM Open: 1.5912 Close: 1.5902
      CCIZLR::isZlrEntry - ENTER: Long
      CCIZLR::isTrending - ENTER: Long
      CCIZLR::isTrending - ZoneBars[0] = 0
      CCIZLR::isTrending - Sidewinder[0] = 0
      CCIZLR::isTrending - woodiesCCI[0] = 1.5812

      Shortly after this the debug messages stop and the following message is written to the log:

      Error on calling the 'OnBarUpdate' method for indicator 'CCIZLR' on bar 1: Index was out of range. Must be non-negative and less than the size of the collection.

      I assume this is an exception thrown by WoodiesCCI when I try to access WoodiesCCI.SideWinder[0].

      Am I doing something here that is not supposed to work? I double-checked and I am passing the same values to CCIZLR's properties in both cases.

      Comment


        #4
        >> Error on calling the 'OnBarUpdate' method for indicator 'CCIZLR' on bar 1: Index was out of range. Must be non-negative and less than the size of the collection
        This might help: http://www.ninjatrader-support.com/v...ead.php?t=3170

        Comment


          #5
          Thank you all for your help.

          I have discovered a change that makes it work, but I don't understand what my original code was doing wrong.

          CCIZLR contains a private member that holds a reference to the WoodiesCCI indicator. My original code initialized the reference in the Initialize method. When I added this indicator to a chart manually, it worked just fine. However, when I added it to a chart programatically from my strategy, it returned unusual values and received the errors mentioned before.

          I moved the initialization of the WoodiesCCI reference to OnBarUpdate (just after the CuurentBar check) and now the indicator works correctly whether I add it to a chart manually or programatically.

          Can anyone explain why this works differently?

          Thanks,
          Jason

          Comment


            #6
            Sorry I don't know.

            Comment

            Latest Posts

            Collapse

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