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 love2code2trade, Yesterday, 01:45 PM
          4 responses
          28 views
          0 likes
          Last Post love2code2trade  
          Started by funk10101, Today, 09:43 PM
          0 responses
          7 views
          0 likes
          Last Post funk10101  
          Started by pkefal, 04-11-2024, 07:39 AM
          11 responses
          37 views
          0 likes
          Last Post jeronymite  
          Started by bill2023, Yesterday, 08:51 AM
          8 responses
          44 views
          0 likes
          Last Post bill2023  
          Working...
          X