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

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 AttiM, 02-14-2024, 05:20 PM
                          12 responses
                          213 views
                          0 likes
                          Last Post DrakeiJosh  
                          Started by cre8able, 02-11-2023, 05:43 PM
                          3 responses
                          237 views
                          0 likes
                          Last Post rhubear
                          by rhubear
                           
                          Started by frslvr, 04-11-2024, 07:26 AM
                          8 responses
                          116 views
                          1 like
                          Last Post NinjaTrader_BrandonH  
                          Started by stafe, 04-15-2024, 08:34 PM
                          10 responses
                          47 views
                          0 likes
                          Last Post stafe
                          by stafe
                           
                          Started by rocketman7, Today, 09:41 AM
                          3 responses
                          11 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Working...
                          X