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

Debugging with Print

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

    Debugging with Print

    Hi,

    I am trying to debug an indicator code using Print statements. I have a number of custom methods and when I try to use Print I get the following error message:

    Indicator XXX.cs An object reference is required for the non-static field, method, or property 'NinjaTrader.Indicator.IndicatorBase.Print(string) ' CS0120 - click for info

    Is there a way to use Print for debugging outside its scope?

    Incidentally, I also tried using System.Diagnostics.Debug.Print. This compiles but can't find the output.

    Any suggestions would be greatly appreciated. Thank you.

    #2
    Printed outputs within NinjaTrader can be found by going to tools -> outputwindow

    unfortunately, you won't be able to print from outside the indicator

    You will need to use the following from within the script
    Print("debug text here");



    For more tips on debugging: http://www.ninjatrader.com/support/f...ead.php?t=3418
    I tend to favor the use of Drawing objects over print statements as this allows me to see the exact point of the crash on the chart visually. (drawn objects will remain on the chart up until the crash point)

    For external debugging you could go the Visual studio route: http://www.ninjatrader.com/support/h..._debugging.htm
    It says the express version isn't supported but I believe I've been able to get the newest express version to work with it.

    Let me know if I can further assist.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Thanks Lance. I am aware of how to use the Print statement from inside an indicator and I am aware of debugging gin VS. I was hoping it would be a simple thing to perhaps instantiate Print to work outside an indicator.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by elirion, Today, 01:36 AM
      0 responses
      3 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by gentlebenthebear, Today, 01:30 AM
      0 responses
      2 views
      0 likes
      Last Post gentlebenthebear  
      Started by samish18, Yesterday, 08:31 AM
      2 responses
      9 views
      0 likes
      Last Post elirion
      by elirion
       
      Started by Mestor, 03-10-2023, 01:50 AM
      16 responses
      389 views
      0 likes
      Last Post z.franck  
      Started by rtwave, 04-12-2024, 09:30 AM
      4 responses
      33 views
      0 likes
      Last Post rtwave
      by rtwave
       
      Working...
      X