Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator SampleStreamWriter not creating an output file

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

    Indicator SampleStreamWriter not creating an output file

    Hi,

    I'm trying to learn the basics of NinjaScript from sample scripts, and I'm currently working with the indicator SampleStreamWriter located in the NT8 online help guide at
    NinjaScript > Educational Resources > Reference Samples > Indicator > Using StreamWriter
    to write price data to a text file.

    In my NinjaTrader 8 app I opened a chart using the simulated data feed, and it is correctly logging OHLC bars. I then opened the editor, loaded the SampleStreamWriter indicator, and clicked the Compile button. However, no file was created in my Documents/NinjaTrader 8 folder, which is the folder indicated by the editor intelliprompt when I mouse-over the text "UserDataDir" in the path specification.

    So I added the statement
    Code:
    Print(NinjaTrader.Core.Globals.UserDataDir);
    to my OnBarUpdate() block in an attempt to print the value of NinjaTrader.Core.Globals.UserDataDir, using the approach suggested in message #2 of the forum post
    Hello i am using the NinjaTrader.Core.Globals.UserDataDir component in building the path for a file i use in my program / dll When another user installs the

    but nothing was written to my output window, even though I set the default output using
    Code:
    PrintTo = PrintTo.OutputTab1;
    My questions are:
    1. How do I create the file of OHLC values that SampleStreamWriter should be writing?
    2. Why is my Print() statement not writing output to my output window?

    Thank you!

    #2
    Hello Red_70,

    Clicking compile does not run a script, it just compiles this into an assembly.

    You will need to run the script on a chart by right-clicking the chart -> select Indicators -> select SampleStreamWriter from the Available list -> click add in the configured area -> click OK.

    The script will write to file as it processed the data on the chart.
    Prints will appear as the the script processed the data on the chart.

    The script will create the file, you will not have to create it yourself.

    Below is a link to a forum post with helpful information about getting started with NinjaScript and C#. Please watch the NinjaScript Editor 401 training video.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea,

      Thanks so much; it seemed I was missing something obvious! I'll check out the training video :-)

      Comment

      Latest Posts

      Collapse

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