Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT6beta11 crashes - can't run any strategy any more

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

    NT6beta11 crashes - can't run any strategy any more

    Hi again,

    I installed NT6beta11 this afternoon and experiencenow full crashes that make any strategy development currently impossible (didn't have any in NT6beta10):

    I was trying to put together my first custom strategy (without the wizzard) and every time there was an compilation error (e.g. some implicit cast could not be made, etc), the script editor crashed (taking the whole NT6 app down) when I tried to recompile again. So I thought it's just some weird compilation errors. I finally got it to compile error free (after many restarts) ant went on to run it => full crash of NT6 app (with the usual "Send Error Report to Microsoft dialog?")

    Now I tried to run anyof your original scripts from the Strategy Analyzer (I removed my script from the ...\bin\Strategy and bin\Tmp folders to make sure that my novice code can't screw up anything) and I get a full NT6 crash even just by right clicking on any instrument and selecting Backtest... - the usual BackTest dialog doesn't even come up. My Visual Studio Debugger says:


    An unhandled exception of type 'System.StackOverflowException' occurred in NinjaTrader.Custom.dll


    Again: I made sure that my own (probably erronous code) is NOT visible to NT6 any more (my custom strategy did *not* show up in the Strategies list of the Strategy Analyzer window. ) So I am puzzled whyit crashes now.

    Any pointers of what I might be missing are deeply appreciated.

    Peter Lipa




    #2
    imported post

    We recently has a very similar crash report where a user has been using C# templates in his NinjaScript code which then threw a StackOverFlowException as you pulled up any NS object in the editor.

    Please:
    - manually remove file <my documents>/bin/Custom/NinjaTraderCustom.dll
    - manually remove (and save before!) any of your custom indicators and strateges from <my documents>/bin/Custom (and subdirectories)
    - restart NT and open editor -> should work

    You now cen add back your NS custom indicators/strategies piece by piece and see whcih one caused the trouble.

    After you isolated the cause -> please send me the one file question to further investigate to "dierk AT ninjatrader DOT com".

    Also: I suggest not using C# templates for now until we resolved the editor issue.

    Thanks
    DierkNinjaTrader Customer Service

    Comment


      #3
      imported post

      Many Thanks, Dierk.

      After removing the NinjaTraderCustom.dll the original Strategies work again.

      Do I understand this correctly: my custom scripts ALL - even the ones I have open inanother editor windowfor copy/pase and code scratch space- get compiled dynamically when I compile just one andALL areadded to the NinjaTraderCustom.dll and stay there till recompile? I thought it was only stored in the cryptically named .dll in the bin/tmp dir (which corresponds by date/time to the recent compile)? This cryptic dllis what the VisualStudio debugger referst to as the offending culprit ... . I am new to the .NET world (but rathera 'classic' C/C++, python, matlab, etc programmer) so I am a bit unfamiliar with the .NET JITter magic. Maybe a few words for 'novice experts' in a future version of the manual would be helpful (explaining a bit how that magic works? Such an understanding helps then in troubleshooting...)

      Anyway, from now on I remeber to remove the NinjaTraderCustom.dll along with my scripts when I have that problem.

      However, my script (afterreintroducing it into the Scripts folder and compling without compile time errors) is still malicously offending to NT6 and crashes it with the same error message as befor (An unhandled exception of type 'System.StackOverflowException' occurred in 225c631514bd4c36bb6723a648c20957.dll)but now at least the Backtest input window came up.

      I don't think I am doing anything fancy (like templates) in the script, probably just something terribly stupid - so I am sending it to you per email as you suggested (a bit embarassed).

      Thanks a lot so far.

      Peter Lipa

      PS: Dierk,please don't think that my avatar has anything to do what I think about NT6 - it merely expresses my almost permanent state of mind while trading or programming... fits the Ninja theme, I thought. FYI,I am so far very impressed with NT6 and think it is very promising and well designed (better than wealthlab and TradeStation which I both used a while ago). Some initial glitches and not-yet-implemented features are always inevitable when approaching a problem domain ofsuch complexity as ATS development, backtesting and real live auto-trading. Big banks spend lit(t)erally millionsandsupport asmall army of developers to deal with all the issues involved... - you guys nowlevel the playing field for the rest of us- NICE job !


      Comment


        #4
        imported post

        Yes, all your indicators and strategies get compiled into the same custom DLL.

        On your very problem: I will take at look at your script.
        DierkNinjaTrader Customer Service

        Comment


          #5
          imported post

          Did you send me your strategy? I have not yet got anything.
          DierkNinjaTrader Customer Service

          Comment


            #6
            imported post

            Yes, I did yesterday, right away. Hmm, I'll send it again later tonight (in about 4-5 hrs - I am not at my home computer right now). I sent it asan uncompressed attachment - maybe somehyperactiveSMTP virus checkerdoesnt pass through.cs files? I'll resend it as a zipped file and renamed to a .txt extension. Rename it to .zip please- that should be the safest way to get it through, in my experience.

            Comment


              #7
              imported post

              Still have not got anything. Please make sure you go by excat mail as per below.

              Thanks
              DierkNinjaTrader Customer Service

              Comment


                #8
                imported post

                Just came home and sent off another email to you. TIA

                Comment


                  #9
                  imported post

                  The problem is your code at
                  Code:
                  set { RiskPerUnit = Math.Max(0.0, value); }
                  It should be
                  Code:
                  set { riskPerUnit = Math.Max(0.0, value); }
                  Note the small "r" on "riskPerUnit".

                  Interesting: Your code produced a stack overflow which NT is supposed to catch. However, .NET 2.0 no longer allows to catch this particular exception.

                  Here is snippet from the MS docs:
                  Starting with the .NET Framework version 2.0, a StackOverflowException object cannot be caught by a try-catch block and the corresponding process is terminated by default. Consequently, users are advised to write their code to detect and prevent a stack overflow. For example, if your application depends on recursion use a counter or a state condition to terminate the recursive loop.
                  DierkNinjaTrader Customer Service

                  Comment


                    #10
                    imported post

                    Wow - thanks for finding that!

                    This was clearly a novice"s mistake (actually just a typo - my intent was to assign to the lower case variable , of course.)I am a bit surprised how the C# compiler allows assignment to an object in its own definition (and thus infinte recursion) and how it allows to bring the whole app down without giving you a chance to catch it :shock:- what was Microsoft smoking?.

                    I guess you willbe troubleshootingthis particular kind of novice-mistake many more times in the near future when more users start writing C#script without being C# gurus.

                    Main problem is, therecome no debugging tools for runtime errors with that Ninjascript 3rd party component (yet). Are they working on one? Programming NinjaScript without debugger reminded me ofmy mainframe programming days some 20 years ago,when I was putting in print statments at every other line of FORTRAN code to figure out what was going on...

                    Did you ever have a look at IronPython (the first and only truly dynamic .NET scripting language where the border between interpreter and compiler vanishes)?. It's less popular of course, but may have some desirable advantages for a project like Ninjatrader (e.g. no licence fees, a built in debugger, clear separation between your app and user code while maintaining fully compiled CILspeed. Users can inspect variables in the interpreter first and then compile once it's working, etc etc etc? You might thus be able to give your users -besides C# -more alternatives of a scripting language-thereby supporting the mainspirit of .NET? I am not 100% sure,but my 90%guess is that the IronPython interpreter would never let sucha mistake (typo)bring down the app.

                    Again, many thanks for your prompt help.


                    Comment


                      #11
                      imported post

                      We looked into providing debugging capabilities, but due to .NET issues/limitations a debugger would not work as expected.
                      DierkNinjaTrader Customer Service

                      Comment


                        #12
                        imported post

                        Here is snippet from the MS docs:
                        Starting with the .NET Framework version 2.0, a StackOverflowException object cannot be caught by a try-catch block and the corresponding process is terminated by default. Consequently, users are advised to write their code to detect and prevent a stack overflow. For example, if your application depends on recursion use a counter or a state condition to terminate the recursive loop.
                        Translation:

                        We, the gurus at Microsoft really can't figure out how to catch this kind of error. So please, dear user, write your code from now on error free :P!


                        Comment


                          #13
                          imported post

                          Dierk Droth wrote:
                          We looked into providing debugging capabilities, but due to .NET issues/limitations a debugger would not work as expected.
                          I can imagine. A Visual Studio like debugger would open up the whole app to the user since there is no separation between app code and user script code.


                          Maybe give IronPython a second thought? (I mean not as a replacment of Ninjascript, but as option at the side?) It was developed exactly for the kind of needs the Ninjatrader has - a .NET app in need of an interpreter that ties seamlessly into the .NET architecture and produces JIT compilable CIL code. Comes with built in debugger and is Microsoft supported (actually Microsoft developed!).

                          Obviously, customers are willing to learn even stranger custom languages (like notso-EasyLanguage, Wealthlab script, etc)

                          Comment


                            #14
                            imported post

                            Thanks for pointing this out. However, the limitation mentioned is a limitation of the CLR and thus likely will be same for all .NET languages.
                            DierkNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by stafe, Today, 12:34 PM
                            2 responses
                            10 views
                            0 likes
                            Last Post stafe
                            by stafe
                             
                            Started by asmmbillah, Today, 11:18 AM
                            1 response
                            14 views
                            0 likes
                            Last Post NinjaTrader_ChrisL  
                            Started by nickse2003, Today, 09:56 AM
                            1 response
                            24 views
                            0 likes
                            Last Post NinjaTrader_ChristopherJ  
                            Started by ATMtrader0001, Today, 10:08 AM
                            5 responses
                            33 views
                            0 likes
                            Last Post ATMtrader0001  
                            Started by WHICKED, Today, 09:47 AM
                            1 response
                            21 views
                            0 likes
                            Last Post NinjaTrader_Spencer  
                            Working...
                            X