• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Getting errors and crashs since updating .NET, on loading a strategy/in Script Editor

  • Filter
  • Time
  • Show
Clear All
new posts

    Getting errors and crashs since updating .NET, on loading a strategy/in Script Editor

    Hi !

    I'm experiencing some majors issues, since installing Visual Studio a few weeks ago, and so, updating the .NET in the same time than installing Visual Studio.

    Since then, when i load a "big" strategy on a chart, or when i am in the NinjaScript editor, i highly often experienced crash's for the Editor, and freeze of the Tab group of the chart who freeze, or crash's.

    About the freeze, what happen is that i can still access the other windows of NinjaTrader 8, but the use of my processor that NinjaTrader has, which is often between 10-20%, drop down to 0-1%, and so the rest of the plateform is not frozen, but not working either.

    The crashes in the NinjaScript editor seem to happen "randomly", but the freeze or crash's when loading a strategy happen only after the strategy has ended is calculation on all historical bars, is transitioning to real-time, and is starting to plot. The freeze happen right before the strategy plot.
    And the freeze with a strategy happen 3 time out of 4 when loading the strategy, and then i need to close Ninjatrader trough the Task Manager.

    The issue and error's that i receive are : (not originally in english, so its not a perfect translation)
    - NinjaTrader cease to interact with Windows and got closed.
    - Failing application NinjaTrader & Failing module KernelBase.dll
    - (maybe its not related, but i get this message only after a NinjaTrader crash) Beta functionality EseDiskFlushConsistency is activated in ESENT
    - Application NinjaTrader, process stopped in reason of an exception not handled

    Those message don't happen all at once, and Ninjatrader can also crash in the same way or freeze without creating error reports in the windows event logs.

    I tried to remove Visual Studio from my computer; to re-install NinjaTrader with a fresh NinjaTrader folder in documents, and re-put only the essential files of my old folder; to clean up the files in the document folder; to make sure that i had the last version of .NET; tried to install a previous version of .NET but didn't succeed; use software of errors solving around thoses .NET errors; remove my workspace and start with a new one; etc.

    I would also like to share, that the strategy that cause the freeze and sometimes immediate crashes, had already been created before i install Visual Studio and update .NET, so its most likely not the strategy herself that cause the crashes (and also from time to time she run properly, and of course causing a crash on the next reload).

    Anyway, some help would be highly appreciated, and i saw that others peoples had the same issue, and the support redirected them to send errors reports and logs trough mail. So even if i gave you the error's shortened, i can totally send all the error's, and log files if needed.

    Thanks a tone, and have a fantastic day !

    Hello Robinson94,

    Thank you for your post.

    Are you running your strategy with Visual Studio open and Debug Mode enabled?

    Please send me your log and trace files so that I may look into what occurred. You can do this by going to the Control Center-> Help-> Mail to Platform Support. Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

    Please list 'ATTN: Patrick H' in the subject line and reference this thread in your email.

    I look forward to your response.
    Patrick H.NinjaTrader Customer Service


      Issue fixed here is the solution !!

      Hi !

      I wanted to share, that after 4 months of the issue, i have been enable to find the solution to the issue, and the reasons of why i had crashes, maybe it can help others. I have fixed the issue for half a week, and have reloaded the script multiples thousand times (trough a script), and have experienced no issues (other than one crash, yet, the dll was like user32.dll and not the kernelbase.dll that i experienced before). Before this, the issue would happen on average every 5 reload, so we can say the issue is fixed !

      First, thanks a lot for the help that Patrick from the support has offered, without his fantastic help the issue could not have been found.

      Also, this is a long post, yet, i want to fully and precisely share specification of the issue, the solution to it, and the process to find the solution.

      So, the issue (of freeze and crashes of NinjaTrader when a specific strategy is loading going from historical to realtime), was not from my computer, from windows, or from any files in NinjaTrader, it was actually caused by the code of the script.
      This has been found after testing the script on another computer with the same conditions than on the one i use, and it had the exact same issue (yet, i restored my computer before finding this, ahah !)

      For finding the code that was creating the issue, since i had at least 10 000 lines of code, i followed this process.
      - Load older versions of the script, i saw that some older versions did not had the issues.
      - Since the older versions would not be totally operational since i had modified the tools that they used, i had an idea of where the issues started, but not a precise idea.
      - I then found a backup of the script that was operational and had the issues.
      - And then, i simply scraped the code pieces by pieces, until the the issue was not there.

      So, the code that was creating the issues, were the USE OF AN ADDON to transfer data from the script of the strategy to scripts of indicators (tools for the strategy), and the other way around. Doing this trough creating public static variable in an addon and doing the following process :

      sending data from a private variable from the strategy script --> public static variable in the addon script --> receiving data from the addon, into a private variable into the indicators scripts

      And the other way around (indicator sending data to addon, which the strategy get)

      And to be still be enable to share data between the strategy and the indicators, all that was needed, was to eliminate the use of the addon, and replace it by the use of public and public static variable.

      So, if for example my strategy wanted to receive data from an indicator already loaded in the strategy, i will use a simple public variable :

      variable from the strategy <-- getting data from a public variable from the indicator (no need for static)

      And if i needed the indicators to get data from the strategy, since the strategy is not loaded in the indicators (anyway i don't think so), i would use public static variable :

      variable from the indicator <-- getting data from a public static variable from the strategy

      It was that simple, and that hard to find at the same time.

      I would like to add, that after removing any use of the addon in the strategy or indicators, i had like 1 kernelbase.dll crash (the issues i was experiencing), yet, only after like 50 reload of the script (at the time of the day when the issue would happen 1/2 time). And after totally removing the addon from NinjaTrader, i had not experienced the issue for multiples thousand times.

      I have no idea why this was happening, maybe, since the frequency of the issue was way higher the faster the markets moved, and that i use a chart with a lot of bars, maybe an addon (which from what i know is constantly loaded), has issues to handle the Realtime transition when it has over 20 variables to handle, like i had.
      Also, it was in the conversation with Patrick trough mail, yet not on the forum, that, if the script was loaded successfully, and that i didn't touch it, it would never crash, and yet, if i used the NinjaScript editor, then, it could crash, so i could crash on the strategy transition to realtime, or when using the editor, weird, probably because of the addon of course.
      I did not had any issue with the editor too.

      I hope, if anyone has the same issue and find (and read), this post, it will be of help.

      Have a fantastic day !


      Latest Posts


      Topics Statistics Last Post
      Started by RuthB, Today, 09:41 PM
      0 responses
      Last Post RuthB
      by RuthB
      Started by dtl-saw, Today, 08:50 PM
      0 responses
      Last Post dtl-saw
      by dtl-saw
      Started by waterman, Today, 07:02 PM
      0 responses
      Last Post waterman  
      Started by authenticx, Today, 03:51 PM
      0 responses
      Last Post authenticx  
      Started by PN720, Today, 12:54 PM
      1 response
      Last Post NinjaTrader_Jim