• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    BertrandNinjaTrader Customer Service

    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?

        http://www.ninjatrader.com/support/h...onbarclose.htm
        BertrandNinjaTrader Customer Service

        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 Sank1, Today, 01:58 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Started by GARZONJ, Today, 12:50 PM
          2 responses
          8 views
          0 likes
          Last Post GARZONJ
          by GARZONJ
           
          Started by guigs88, Today, 12:45 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by FREEN, 08-13-2019, 09:18 AM
          5 responses
          28 views
          0 likes
          Last Post koganam
          by koganam
           
          Started by U0000999, Today, 12:43 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jim  
          Working...
          X