Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Warning for Indicators with Dynamic AddPlots

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

    Warning for Indicators with Dynamic AddPlots

    After loading a workspace, if you get an "Unhandled exception Index was outside the bounds of the array" when middle clicking in the panel for an indicator check the <Plots> section of the indicator in the workspace file. You may find that the section in the <Plots> file is different from the AddPlot calls in the indicator code.

    When an indicator is loaded from a file, the Plots are populated before State.Configure with whatever the indicator found in the file. If the # of AddPlot calls made in State.Configure is less than the number loaded from disk this bug will occur.

    Details

    I have an indicator which dynamically adds plots in State.Configure. When loading one of the workspaces, right clicking to view the data at a given chart position results in "Unhandled exception: Index was outside the bounds of the array." After some debugging by stripping down the file to the smallest difference that reproduces the bug I discovered the problem with the <Plots> section of the indicator. The problem file had one extra <Plot> in it versus the file that loaded fine. The data box that comes up by middle clicking gave the error. The plots displayed in the box were also incorrect reflecting the text in the file instead of the text the indicator gave the plots when it added them. I'll have to investigate why the plots are different.
    Last edited by ntbone; 03-26-2023, 07:38 PM.

    #2
    Yes, this has been true for a long time that if you saved the workspace with a different number of plots than the number that are configured you can get an error message the first time re-opening the workspace. If you save it again, the workspace should be corrected to the right number of plots. It could be that only plots added in the SetDefaults stage (which are therefore user configurable and not just added on the fly at runtime) are saved in the workspace.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Hello ntbone,

      Thanks for your post.

      QuantKey_Bruce is correct. As they stated, if you saved the workspace with a different number of plots than the number that is configured, you may get an error message similar to what you noted when re-opening the workspace. When the indicator is removed and re-added or reloaded, and the workspace is saved again, the workspace will save the correct number of plots.

      Please let me know if I may assist further.
      Brandon H.NinjaTrader Customer Service

      Comment


        #4
        It would be nice if Plots wouldn't be saved if they are created in State.Configure. Unless AddPlot is called in State.SetDefaults, there won't be any UI to configure them. If there is no UI to configure them then there are no user changes to save. I tested stripping out the <Plots> section from the indicators that have the issues and they load without error.
        Last edited by ntbone; 03-28-2023, 12:48 AM.

        Comment


          #5
          Hello ntbone,

          Thanks for your note.

          I have submitted your feature request to the Development team and added your vote to it. This request is being tracked under the number SFT-5830.

          As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

          Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

          Please let us know if we may be of further assistance to you.​
          Brandon H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          2 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Working...
          X