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

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 algospoke, Yesterday, 06:40 PM
      2 responses
      18 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      44 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      20 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      180 views
      0 likes
      Last Post jeronymite  
      Working...
      X