Announcement

Collapse
No announcement yet.

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.

    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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          656 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          370 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          574 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          577 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X