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.

    #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.

      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.

          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.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by vitalpilot, Today, 11:14 PM
              1 response
              2 views
              0 likes
              Last Post ezrollin  
              Started by PaulMohn, 09-15-2021, 05:25 AM
              21 responses
              106 views
              0 likes
              Last Post omololu
              by omololu
               
              Started by mcosta72, Today, 04:09 PM
              0 responses
              17 views
              1 like
              Last Post mcosta72  
              Started by Quanto, Today, 02:50 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Started by Trader108, Today, 01:45 PM
              2 responses
              16 views
              0 likes
              Last Post Trader108  
              Working...
              X