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

saving quotes to file at each new bar

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

    saving quotes to file at each new bar

    Dear friends.
    I want to export bars from the chart to file on each bar update.
    I get one source from member of this forum and try to change it for live saving data.
    But unfortunately this strategy insert into file 01.01.1800 0:00:00,0,0,0,0 at each row, and I want to see OHCL data at this file, like 0.012652;0.012645;0.01265;0.012652;18.07.2011 1:01:00.
    I attached file with source.
    Attached Files

    #2
    Hello daglas, I would suggest you take a look into this sample we published here :



    It would use C# 's System IO to write the bars data to a text file, you could also add the bars time (Time[0]) to the saved strings.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      it's a perfect code, thx very much. But how can I reduce length of history data. For exemple I want to save only last 100 candles data. Or if it be more simple to save only today data?

      Comment


        #4
        Daglas,

        You could add date/time checks for this. Here is an example that checks date equality with the bar's time stamp and your computer clock.

        if (Time[0].Date == DateTime.Now.Date) { }

        Last 100 bars would be something like:
        if (CurrentBar > Bars.Count - 100) { }
        Last edited by NinjaTrader_RyanM1; 07-22-2011, 09:56 AM.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ok, thanks. It's perfect.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by samish18, 04-17-2024, 08:57 AM
          16 responses
          55 views
          0 likes
          Last Post samish18  
          Started by arvidvanstaey, Today, 02:19 PM
          3 responses
          9 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by jordanq2, Today, 03:10 PM
          2 responses
          8 views
          0 likes
          Last Post jordanq2  
          Started by traderqz, Today, 12:06 AM
          10 responses
          18 views
          0 likes
          Last Post traderqz  
          Started by algospoke, 04-17-2024, 06:40 PM
          5 responses
          47 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X