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 Hwop38, 05-04-2026, 07:02 PM
          0 responses
          160 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Started by CaptainJack, 04-24-2026, 11:07 PM
          0 responses
          307 views
          0 likes
          Last Post CaptainJack  
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          245 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          348 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          178 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Working...
          X