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

Writing to text file

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

    Writing to text file

    Thanks to NT Josh for the reference examples on reading and writiing text files.



    Whats the difference between calling file IO and using a stream please?

    #2
    Freddo, the difference is performance (steam reader / writer) vs. ease of use (System.IO File)
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I have a data base that analyses data using stored procedures.
      It would take me waaay too long to write the logic as Ninja Script.
      I can load the initial data via export from NT but I would like to
      write to a text file on a 1 minute chart then as a back ground process I will have a scheduled job in my database which will read that file
      and analyse it on 1min, 3min, 5min, 15min and 1hour basis
      it will then alert me if anything interesting is developing.

      I will conduct my own tests but do you think System.FileIO will perform okay doing small frequent writes?

      Comment


        #4
        Freddo, as you noted you would need to test in your individual scenario, but for small read / write operations the System.IO File should do it.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks Bertrand
          Regards
          Freddo

          Comment


            #6
            I have Josh's example of sing File IO on a 1 minute chart.
            Loading the indicator writes a file of the bars on the chartbut the file is not getting updated as the chart updates

            Comment


              #7
              Freddo, not sure what you mean, the sample exports the history to a text file and the adds in realtime to it...as result it displays the current days OHLC to the output window.

              The file created sits in the MyDocuments\NinjaTrader 6.5 folder and is named 'SampleFileReadWrite-MyTestFile' per default.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Hi Bertrand,
                it exports the historical then starts updating and stops.
                I do not see the days OHLC.

                I am wondering if when the indicator script is trying to update the text file
                and my program is reading the same file then my data base loader utility is reading it.

                Regards
                Freddo
                Last edited by Freddo; 08-20-2009, 03:29 PM. Reason: just correcting spelling

                Comment


                  #9
                  Freddo,

                  Please check your Control Center logs for errors. You likely cannot read and write at the same time.
                  Josh P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by ScottWalsh, Today, 06:52 PM
                  4 responses
                  32 views
                  0 likes
                  Last Post ScottWalsh  
                  Started by olisav57, Today, 07:39 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post olisav57  
                  Started by trilliantrader, Today, 03:01 PM
                  2 responses
                  19 views
                  0 likes
                  Last Post helpwanted  
                  Started by cre8able, Today, 07:24 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post cre8able  
                  Started by Haiasi, Today, 06:53 PM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X