Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

NT8 NinjaScript Log(...) has 2 related bugs.

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

    NT8 NinjaScript Log(...) has 2 related bugs.

    Hello,

    The NinjaTrader8 Log(...) method has 2 related bugs that can be quickly reproduced by running the attached strategy in a back-test in the current production version of NT8.

    Both bugs occur when running the following code:

    Code:
    Log(@"Logging Information. Background should be white.", Cbi.LogLevel.Information);
    Log(@"Logging Alert. Background should be yellow.", Cbi.LogLevel.Alert);
    Log(@"Logging Warning. Background should be orange.", Cbi.LogLevel.Warning);
    Log(@"Logging Error. Background should be red.", Cbi.LogLevel.Error);
    Bug #1: The background colors of log items in the NinjaTrader8 log are mixed up.

    The second line logs an alert. It should be yellow. It is red.
    The third line logs a warning. It should be orange. It is yellow.
    The fourth line logs an error. It should be red. It is orange.

    Bug #2: The following line that is supposed to log an alert opens a dialog box during a back-test whose window title is "Error":

    Code:
    Log(@"Logging Alert. Background should be yellow.", Cbi.LogLevel.Alert);
    Note that this opens a dialog box every time an alert is called in a back-test. This can end up being 100 modal dialog boxes that need to be closed.

    Thanks,

    EquityTrader
    Attached Files

    #2
    Hello,
    Thank you for the post.
    I am processing your inquiry and will have a reply shortly.
    I look forward to assisting further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hello,
      Thank you for your patience.
      Can you check that these are set the way you would like under the properties? Navigating to the log tab> right click> Properties > Select the colors you wish the log to display.
      If there is anything else I may assist with please let me know.
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        NinjaTrader_ChrisL,

        Thanks for the quick and helpful reply.

        Regarding Bug #1, you are 100% right. My logging colors were set funny. There is no bug in NinjaTrader.

        Regarding Bug #2, I think it is still a bug. In back-test mode, NinjaTrader8 correctly doesn't play sounds and send emails when PlaySound(...) and SendMail(...) are called, but it incorrectly shows an alert dialog box with the window title "Error:" when the following line of code is called:

        Code:
        Log(@"Logging Alert. Background should be yellow.", Cbi.LogLevel.Alert);
        Shouldn't this dialog box only appear in real-time mode, not in back-test mode?


        The problem is that back-testing over 10 years of data could generate 1,000 dialog boxes.

        Thanks,

        EquityTrader

        Comment


          #5
          Hello,
          Thank you for the reply.
          I don't believe this is a bug but I will question product management if this would be expected. I would recommend using either a Boolean flag to only print the log once like you have in your code or switch the Log statements to Print() when back testing so that the message is printed to the NinjaScript output window instead of an alert dialog.
          Please let me know if I may be of any further assistance.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            NinjaTrader_ChrisL,

            Your suggested workarounds would certainly accomplish the goal, but they are still workarounds.

            The beautiful thing about PlaySound(...) and SendMail(...) is that they don't require such workarounds to avoid playing 100,000 sounds or sending 100,000 emails during a long back-test, since they are well-designed for easy and trouble-free use in both back-test mode and real-time mode.

            It would be a very nice touch if the NinjaTrader development team changed calls to Log(...) with a LogLevel of Cbi.LogLevel.Alert to act in a similar way.

            I understand that the "bug" I reported isn't a big "Bug" with a capital 'B', but fixing it would definitely improve the NinjaScript strategy development process, just as PlaySound(...) and SendMail(...) do today. I realize that the priority has to be on serious bugs, but I am under the assumption that the NinjaTrader development team really wants to make NinjaTrader as perfect as possible.

            Thanks,

            EquityTrader

            Comment


              #7
              Hello,
              Thank you for the reply.
              We have a request to add a feature that functions like Alert, but does not execute during backtesting, called AlertBacktestSilent. The feature ID is SFT-2402. I will add your vote to that feature.

              You may also use the example below so the strategy can be run in a backtest or live without having to change the code:

              Code:
              Log("Hello World", Account.Name=="Backtest" ? LogLevel.Warning : LogLevel.Alert);
              If there is anything else I may assist with please let me know.
              Chris L.NinjaTrader Customer Service

              Comment


                #8
                NinjaTrader_ChrisL,

                Thank you very much for all of your help.

                EquityTrader

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by mjairg, 07-20-2023, 11:57 PM
                3 responses
                213 views
                1 like
                Last Post PaulMohn  
                Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                4 responses
                544 views
                0 likes
                Last Post PaulMohn  
                Started by GLFX005, Today, 03:23 AM
                0 responses
                3 views
                0 likes
                Last Post GLFX005
                by GLFX005
                 
                Started by XXtrader, Yesterday, 11:30 PM
                2 responses
                12 views
                0 likes
                Last Post XXtrader  
                Started by Waxavi, Today, 02:10 AM
                0 responses
                7 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Working...
                X