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

Error: Failed to call method 'OnCalculateMinMax' on chart object 'ChartBars'

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

    Error: Failed to call method 'OnCalculateMinMax' on chart object 'ChartBars'

    Why would one receive the following error: Failed to call method 'OnCalculateMinMax' on chart object 'ChartBars': Collection was modified; enumeration operation may not execute.

    Circumstances:
    • Happens in an AddOn I am developing
    • Only occasionally occurs, not repeatably
    • Occurs when adding an Order to "close" another already Filled Order
    • All Orders are processed as expected, despite the error
    • Although charts exists, they are not in any way used to submit the Order; it is done via an entirely separate AddOn UI
    Thanks.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #2
    Hello jeronymite,

    The error means a value used for a plot or set to the MaxValue or MinValue is not a valid number 'NaN'.

    May I confirm that you have printed every value set to plots and that these are all valid numbers?


    As a heads up, Indicators can set plot values and set the MaxValue / MinValue for OnCalculateMinMax, but Addons cannot. If this script is actually an addon, this would be invalid.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Chelsea.

      This only occurs rarely when running an AddOn and only when the AddOn submits Orders that effectively close open positions. Although there is a simple Indicator on the chart, the AddOn does nothing related to Indicators.

      Thanks.
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #4
        Hello jeronymite,

        That would be issue. It's an addon. Addons cannot be applied to a chart and cannot set the MaxValue MinValue or plot values.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks, Chelsea. But as noted above, the AddOn has zero interaction with charts. It is not that. When the error occurs, it coincides with the AddOn submitting Orders that "close" already filled and active Orders. That is the full extent of the "involvement" of the AddOn. Further thoughts on the matter most welcome.

          Thanks.
          Multi-Dimensional Managed Trading
          jeronymite
          NinjaTrader Ecosystem Vendor - Mizpah Software

          Comment


            #6
            Hello jeronymite,

            If the addon has zero interactions with charts, can we be certain that is the script causing the error?

            In a new workspace with a new chart with no indicators does the error appear? If you open your addon window, does the chart suddenly start having errors?

            Does the addon have undocumented code to interact with charts?

            My guess would be that you are not investigating the correct script, as the script causing the error is likely applied to the chart and attempting to set a plot or attempting to set the MaxValue/MinValue.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks again, Chelsea.

              The Addon seems to be the catalyst to the error. On the few occasions it has happened, out of many hundreds of executions, it has been immediately after submitting Orders to "close" open positions. There are no interactions with the charts themselves in the AddOn. I am the author of the AddOn.

              Since it is a rare occurrence, but has happened unpredictably on a just a few occasions, it is not "testable" because it is not repeatable.

              The one simple indicator on the charts has been unchanged for years and has never produced any errors. Given the alignment of the errors when they occur with the invocation of the closing Orders, that would seem to be relevant. I am also the author of the Indicator.

              Should it happen again, I will try to note the exact circumstances and continue this thread.

              Thanks.
              Multi-Dimensional Managed Trading
              jeronymite
              NinjaTrader Ecosystem Vendor - Mizpah Software

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by love2code2trade, 04-17-2024, 01:45 PM
              4 responses
              36 views
              0 likes
              Last Post love2code2trade  
              Started by alifarahani, Today, 09:40 AM
              2 responses
              13 views
              0 likes
              Last Post alifarahani  
              Started by junkone, Today, 11:37 AM
              3 responses
              15 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by pickmyonlineclass, Today, 12:23 PM
              0 responses
              1 view
              0 likes
              Last Post pickmyonlineclass  
              Started by frankthearm, Yesterday, 09:08 AM
              12 responses
              44 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Working...
              X