Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to export Output Window programmatically to a text file?

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

    How to export Output Window programmatically to a text file?

    Hi!

    I notice that the Output Window can only display
    a certain number of rows.

    Once it reaches the limitation, it will append new rows
    and my initial output data will be replaced.

    How can I have my strategy to export the content of the
    Output Window to a simple text file?

    Cheers!
    Jim

    #2
    Jim,

    If you have that many lines to export I suggest you write to a file from the get-go.


    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      Do I need those Ninjatrader Generated Code at the bottom of each sample?
      Appreciate the quick reply!

      Jim
      Last edited by ninjaq; 03-24-2009, 01:56 PM.

      Comment


        #4
        Yes. Do not remove or modify anything down there.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Which method is better if my strategy is performing a lot of output at each tick at different parts of the code?

          Comment


            #6
            StreamWriter one.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Cool! Thanks!

              Comment


                #8
                Josh,

                I can't seem to get it work for my strategy.
                Basically here's what I've done:

                1. Added the declarations, "using System.IO;"
                2. Added the object, "private System.IO.StreamWriter sw;"
                3. Added the try/catch block to the Initialize() function
                4. Replace all Print() statements with sw.WriteLine()

                I tried adding all the namespace in the sample given but I can't compile.
                Can you help by showing a quick example for a sample strategy.. let's say it goes LONG at the close of each bar with
                Target: 10ticks, Stop Loss: 10 ticks

                This will be very useful.
                Thanks!

                >Jim

                Comment


                  #9
                  Did you add the "private string path"?
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Yes I did!

                    5. Added "private string path"

                    Can you help me to tackle the Namespace region of the code?
                    Assuming my strategy name is "strategy123", which part of the code in the Namespace region do I need to rename?

                    Thanks!>Jim

                    Comment


                      #11
                      ninjaq,

                      Do not mess around with the namespace things. Just go Tools->New NinjaScript and create a new indicator. Only add the appropriate lines from the sample withOUT changing anything else.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Josh,

                        But I want to implement this feature into my current strategy, not an indicator.
                        Appreciate if you could show me a quick code layout on which code of the sample I should add to...

                        >Jim

                        Comment


                          #13
                          Jim,

                          Same thing applies. Create a new strategy from the wizard and press unlock code. Only copy over the pertinent lines like the using line, variable declarations, etc. Just work inside the Initialize(), OnBarUpdate(), etc. Do not touch the namespace "framing" things.
                          Josh P.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          558 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          324 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          101 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          545 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          547 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X