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

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?

        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 gbourque, Today, 06:39 AM
          2 responses
          14 views
          0 likes
          Last Post gbourque  
          Started by rexsole, Today, 08:39 AM
          0 responses
          4 views
          0 likes
          Last Post rexsole
          by rexsole
           
          Started by trilliantrader, Yesterday, 03:01 PM
          3 responses
          30 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          4 responses
          26 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Brevo, Today, 01:45 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X