Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

some namespaces change themselves to match the subfolder under Strategies

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

    some namespaces change themselves to match the subfolder under Strategies

    When trying to determine the cause of some unhandeled exceptions, I found that in four scripts the namespace had changed to:
    ' namespace NinjaTrader.NinjaScript.Strategies.SamplesDownload ed ' SamplesDownloaded is a folder I created in Strategies.

    Is this a normal behavior or did I do something wrong? Does it matter?

    I don't know if that had anything to do with the unhandled exceptions. That happened with
    a different script, SampleIsFallingIsRising.cs Ultimately I did a clean reinstall of NT and left the troubled scripts out. I also ran sfc /scannow on my computer and it fixed some bad files in the OS. Now it works fine but I need to understand if I can keep scripts in subfolders and if something I did caused this.

    The scripts with the changed namespaces are:

    SamplesMonitorStopProfit
    SampleMultipleEntryExitSignals
    SampleOnOrderUpdate
    SamplePriceModification

    The one that caused the unhandled exception is (but the system had been acting up and NT had crashed several times:

    SampleIsFallingIsRising.cs

    I can send these to you is you want.

    Thank you.

    #2
    Hi JGRtrader, thanks for your post.

    The namespace would not cause an unhandled exception. If there were a problem with the namespace the script would not compile. It is expected for scripts within subfolders to append the folder name to the namespace. If you look in the Log tab of the Control Center, is there a description of the unhandled exception?

    Best regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      You asked for logs. Before reinstalling NT, I saved the NT folder in Documents to a thumb drive and then deleted it. I looked on the thumb drive and found three log entries that may tell some of the story. I attached three of them.

      All of these the last entry was "Workspace Developing not saved." These scripts captured that when I would click the Strategy button on the chart, it would just close - poof gone.


      00013 is the last one before I uninstalled NT before reinstalling. log.20210516.00013.txt
      00008 is from a some before, and shows unhandled exception. log.20210516.00008.en.txt
      00007 is from the night before, and shows what I think was the culprit. log.20210516.00007.en.txt

      00007 shows a new script "Bankaccount" that I had made from the Editor Strategy starter to test if I could put some code like that found in a MS Tutorial "Explore object oriented programming with classes and objects" into a strategy. Answer is NO. I deleted it. At that time I was running several other indicators showing my intermediate calculations in lower panels. MyTestPanelPlot is for one of the lower panels that is run from my main program. These things had been working fine for many days .
      Last edited by NinjaTrader_ChrisL; 05-17-2021, 09:30 AM.

      Comment


        #4
        Hi JGRtrader, thanks for your reply.

        I removed the uploaded log files because they contain sensitive information. Send them to scriptingsupport at ninjatrader.com if you need to send them in. I see there is an issue with the database loading the strategies. Please reset the database and test the strategy again afterwards:
        • Shutdown NinjaTrader and Go to the Start Menu
        • Select My Documents--> NinjaTrader 8--> db--> "NinjaTrader.sdf" file (may only say 'NinjaTrader' depending on your Windows File Explorer settings)
        • Right click on NinjaTrader.sdf and select "Rename" *Name it "OLDNinjaTrader.sdf"
        • Then restart the software and NinjaTrader will create a fresh database file to use
        • Unfortunately the following items stored in the old database will be lost - Trading Hours templates, Instrument Lists / Custom Instruments, historical trade execution data, saved Strategy Analyzer backtest results
        Best regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Chris L.,

          I reinstalled NT from scratch after deleting its entire folder in Documents. So the DB was recreated after the reinstall and resetting should not be necessary at this time. But good to know how to do that.

          Do you need those files? Could the database corruption have been the whole problem?

          Thank you..

          Comment


            #6
            Hi JGRtrader, thanks for your reply.

            All strategy instances are held within the database, so it could have been the source of the crashing you were seeing. Please test the strategy on the new installation.

            Best regards,
            -ChrisL
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Chris L.

              I tried the suspect cs file again and it did the same thing. It compiled fine. But I went to put it on a chart and when I clicked the icon, the system froze a few seconds then poof gone. I captured the event in the log file, trace file and as well in the Windows Application Event Viewer and saved them. The blow up appears to occur in the CLI.DLL but I am no expert in reading this stuff. Just enough to get into trouble.

              EDIT: I commented out four lines of code in the offending cs file and it now runs after restarting NT a couple of times. I had done something wrong that the compiler did not catch. I had been experimenting with various configurations in that cs file until I created one that caused it to crash.

              I did not reset the database.
              Last edited by JGRtrader; 05-18-2021, 03:42 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by jclose, Today, 09:37 PM
              0 responses
              4 views
              0 likes
              Last Post jclose
              by jclose
               
              Started by WeyldFalcon, 08-07-2020, 06:13 AM
              10 responses
              1,413 views
              0 likes
              Last Post Traderontheroad  
              Started by firefoxforum12, Today, 08:53 PM
              0 responses
              10 views
              0 likes
              Last Post firefoxforum12  
              Started by stafe, Today, 08:34 PM
              0 responses
              10 views
              0 likes
              Last Post stafe
              by stafe
               
              Started by sastrades, 01-31-2024, 10:19 PM
              11 responses
              169 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X