Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Mystery Print

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

    Mystery Print

    I was debugging a strategy on a new windows machine I've been using specifically for writing ninjascript. It's a brand new Intel NUC 11 and pretty much the only thing I've installed and use on it is ninjatrader.

    During recent debugging I had a print statement that printed out line 293. I started seeing this coming up in my output window even though none of the indicators or strategies attached to any charts had a print statement with 293 in it.

    Thought I was crazy and came back the next day (today) and was surprised to see that I still could not find where it was coming from so I figured I'd remote into another one of the windows machines I use to run ninjatrader and I saw that not only did the code I was working on not print 293 on this new machine but the code itself worked on the second machine whereas it didn't on the machine I was working on originally (the NUC that prints 293). Specifically a histogram that uses a tertiary data series as part of a strategy - the custom indicator is added to the chart so while looking for the 293 I was surprised that it was plotting.

    The thing I wanted to highlight and ask about is how this is possible. The code I was working on I complied > exported > uploaded to cloud > downloaded to second windows machine > different behavior. Specifically the first two behaviors that are different: not printing 293, mtf histogram working.

    To eliminate as many variables as possible, on both machines I created a new fresh workspace and used fresh templates for the charts so I know there's nothing sneaking in there.

    Seems like it may be a situation where I need to just reinstall on the NUC but that is disconcerting because I have no idea what the issue is.

    One thing that may or may not be related: this new machine has been crashing ninja regularly but I've been chalking that up to inefficient code I've been writing - but this has never been an issue on any other computers I've used for similar work. Could be hardware related?

    Any insight from anyone is greatly appreciated.

    #2
    Hello WalterSkinner,

    There are really no details here to know what may be happening besides your script/something you have in your NinjaScript is printing. You can try using windows file explorer to do a search through the folder: Documents\NinjaTrader 8\bin\Custom. You would need to search for Print and also Output.Process to see what may be causing prints. The print doesn't let you know where the print is coming from so you would need to investigate the scripts you have to see which have prints and which may be printing.

    If the code you made is working on one machine and not another you would need to use prints to debug the code. That would let you know what is changing to allow it to work on one machine and not the other.

    If you are getting crashing while writing custom code the code may be the cause. You would also need to debug the code in this use case to see what toggles the crash to happen or not. With that knowledge you could explore that part of the script further to see about a solution. If you otherwise just having crashing happen I would suggest to write into [email protected] to get further assistance. We can review your log files to check if there are any details surrounding the crash and if so there may be a solution for that.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello WalterSkinner,

      There are really no details here to know what may be happening besides your script/something you have in your NinjaScript is printing. You can try using windows file explorer to do a search through the folder: Documents\NinjaTrader 8\bin\Custom. You would need to search for Print and also Output.Process to see what may be causing prints. The print doesn't let you know where the print is coming from so you would need to investigate the scripts you have to see which have prints and which may be printing.

      If the code you made is working on one machine and not another you would need to use prints to debug the code. That would let you know what is changing to allow it to work on one machine and not the other.

      If you are getting crashing while writing custom code the code may be the cause. You would also need to debug the code in this use case to see what toggles the crash to happen or not. With that knowledge you could explore that part of the script further to see about a solution. If you otherwise just having crashing happen I would suggest to write into [email protected] to get further assistance. We can review your log files to check if there are any details surrounding the crash and if so there may be a solution for that.
      The search you suggested in the Custom folder shows that this print statement is located in a strategy that is not applied to the chart. The attached screenshot shows the print occurring while no strategies are running. I reinstalled ninja on this machine and it continues, the reinstall occurred before this screenshot.


      Click image for larger version  Name:	1162023a.png Views:	0 Size:	78.3 KB ID:	1231440
      Attached Files
      Last edited by WalterSkinner; 01-16-2023, 09:09 AM.

      Comment


        #4
        If the code you made is working on one machine and not another you would need to use prints to debug the code.
        Yes I use prints to debug the code, this process is what led me to make this post.
        Last edited by WalterSkinner; 01-16-2023, 09:23 AM.

        Comment


          #5
          I reinstalled a second time after renaming the ninja folders that were not removed when I uninstalled ninja the first time (folders in the documents folder). This seems to have fixed the issue.

          Edit:

          Spoke too soon. I loaded a new editor window and I saw the output window print a bunch of "293"s. I'll try deleting the strategy that is somehow printing this even though it should not be running.

          Edit 2:

          Is there a way to see and kill any strategies and/or indicators running in the background that I do not see or add?
          Last edited by WalterSkinner; 01-16-2023, 09:31 AM.

          Comment


            #6
            Hello WalterSkinner,

            That depends on where the print is in the strategy, OnStateChange is called for every strategy when using the menus of the platform so if its in there that would be expected. If its causing a problem you can also remove the print from that script to prevent it. if the strategy is not enabled in the control center then it is not running.



            JesseNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello WalterSkinner,

              OnStateChange is called for every strategy when using the menus of the platform
              Wow I had no idea this explains so much thank you.

              Comment


                #8
                Hi Jesse,

                Can you elaborate on "when using the menus of the platform"? Where is that? What does that mean? Are referring to the Strategies tab in the Control Center?

                Thanks,
                Matt

                Comment


                  #9
                  Hello StealthM93,

                  When you open the different menus for a type like the strategies menu it has to run all of the strategies OnStateChange to get their default values. The same happens for indicators or any type which has a menu to choose it. In general OnStateChange is called for a variety of reasons through a scripts lifetime.
                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by jxs_xrj, 01-12-2020, 09:49 AM
                  6 responses
                  3,290 views
                  1 like
                  Last Post jgualdronc  
                  Started by Touch-Ups, Today, 10:36 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post Touch-Ups  
                  Started by geddyisodin, 04-25-2024, 05:20 AM
                  8 responses
                  61 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by Option Whisperer, Today, 09:55 AM
                  0 responses
                  8 views
                  0 likes
                  Last Post Option Whisperer  
                  Started by halgo_boulder, 04-20-2024, 08:44 AM
                  2 responses
                  24 views
                  0 likes
                  Last Post halgo_boulder  
                  Working...
                  X