Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X