Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Script won't stop running after closing MA

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

    Script won't stop running after closing MA

    I'm debugging some of my scripts by writing stuff to output. I create a list within the market analyzer, load up the indicators, they fail to load and only "..." is displayed in the MA. Then I close the MA but the scripts continue getting called (OnBarUpdate) and my CPU is used up. I can't stop them running, unless I restart NT.

    Do all scripts keep running once started in MA or is it only the ones that don't initialize properly?
    Is there a way to stop them?

    #2
    Hi braincell,

    If you close the MA window, then this should stop scripts from running as well. Do you have any workspaces open but not active? You can check this using File > Workspace

    Only one can be active (visible), but you can have others running in the background that still process script logic.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      No, I know how workspaces work, I don't have any others open.

      I've just tested it, and it seems that if I get an exception during the loading of one script on one stock, the others get bugged (for other symbols) so that they don't stop running after the MA is closed. I think this is a bug.

      Comment


        #4
        Thanks for the reply. Do you have a simple script and setup instructions so that we can see the same on our end? We could load the xml file from your documents\NinjaTrader 7\Workspaces folder to copy the market analyzer window.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I don't really have a "simple" script, I just have the huge one I'm working on. But I can tell you how to replicate it.

          First, I think I fixed it now after setting up the session hours for all my instruments. Some were off, and the error was happening on Typicals[1][x] where x was out of range. The bug happened because one instrument was loading the same amount of bars but because the sessions were different, it loaded fewer days (I think). Then, [x] was out of range for Typicals. When I opened the instrument as a chart, a whole day was missing and one session was cut in half. I reloaded data and it worked OK (the chart and the script within MA). It's quite confusing for me as to what's really happening but this is the best I can tell you.

          In summary: If sessions are not the same for multiple instruments loaded within the same script (in this case two were loaded) or perhaps within the Market Analyzer as a whole (all instruments must have same session hours), then if data is loaded some bars (ie Typicals[1][x]) are out of range, so the script fails and it seems like the others keep running, but they do not send results to the MA, and once MA is shut down they keep running. I can verify that no chart or other MA window was running any scripts, but I was still seeing the script send data to Output window, thus verifying that some were still running.

          That's the best I can do as far as explaining goes.
          Last edited by braincell; 08-15-2011, 02:09 PM.

          Comment


            #6
            OK, was not able to reproduce by simply forcing an exception and closing MA. We need a script, MA setup details (xml file), and reproducible steps to evaluate this. If you have a work around, that's great. If you can send those details we can look into further.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              I can't send the script really, and I can't spend enough time trying to make a script that will replicate the error without the rest of the functionality.

              Here is one last (important) detail: The script numbers bars with my custom ID based on hour/minute and it seems this numbering method was off when one instrument had a session that ended/started at a time different to the other instrument. To replicate, perhaps you can try seeking for example Typicals[0/1][20] for both instruments, where the second instrument has a different session applied to it which excludes some times of the first instrument's session.

              The other possibility is that the script ran before the first symbol was ever added to the instrument manager list, so it wasn't ever loaded before (similar error to the one I had before - but this one gives a different crash). So try seeking values of symbols that have not been added to the instruments list (or anywhere in NT) and see what kind of error that gives you.

              I cannot give any more information than that, so if that's not helpful, I'm sorry I have to move on with my work as I'm already running out of time for debugging as it is.

              Comment


                #8
                Thanks for the additional input.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by funk10101, Today, 09:43 PM
                0 responses
                6 views
                0 likes
                Last Post funk10101  
                Started by pkefal, 04-11-2024, 07:39 AM
                11 responses
                37 views
                0 likes
                Last Post jeronymite  
                Started by bill2023, Yesterday, 08:51 AM
                8 responses
                44 views
                0 likes
                Last Post bill2023  
                Started by yertle, Today, 08:38 AM
                6 responses
                26 views
                0 likes
                Last Post ryjoga
                by ryjoga
                 
                Started by algospoke, Yesterday, 06:40 PM
                2 responses
                24 views
                0 likes
                Last Post algospoke  
                Working...
                X