Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleFileReadWrite Questions

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

    SampleFileReadWrite Questions

    Two questions:
    1. Regarding this code:
    // This is the output string that is written to the text file. 'Environment.NewLine' feeds the file to a new line for further writing.
    string ohlc = ToDay(Time[0]) + " " + Open[0] + " " + High[0] + " " + Low[0] + " " + Close[0] + Environment.NewLine;

    ToDay is an integer value and the Open, High, Low and Close are doubles. Why don't they have to be explicitly converted to strings?

    2. When all of the lines are written to the file for the day, I don't see where the file is closed before the text file is opened for reading.

    Thanks,
    Stephen

    #2
    Stephen, the compiler helps you out doing an implicit conversion here for int and double to the string.

    The file is written and then closed automatically by the command, same would go for the reading operation - this is in contrast to the more advanced StreamWriter / Reader examples we have.

    Comment


      #3
      All but the last candle?

      Hello NT Support.

      When I apply the indicator to a Daily chart (I'm using Kinetic EOD data), it outputs ohlc data for all but the last candle on the chart.

      I'm new to Ninja so please tell me what I'm doing wrong.

      Thanks in advance.

      Comment


        #4
        Welcome to NT and our forums - which CalculateOnBarClose setting are you working with for this study?

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          Welcome to NT and our forums - which CalculateOnBarClose setting are you working with for this study?

          http://www.ninjatrader.com/support/h...onbarclose.htm
          Hello Bertrand.

          I hadn't touched that setting until you pointed it out. It was set to True. I've set it to "False" and now it's fine.

          Thank you!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          561 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          325 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
          547 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