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 CaptainJack, 05-29-2026, 05:09 AM
          0 responses
          256 views
          0 likes
          Last Post CaptainJack  
          Started by CaptainJack, 05-29-2026, 12:02 AM
          0 responses
          166 views
          0 likes
          Last Post CaptainJack  
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          170 views
          1 like
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          253 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          203 views
          0 likes
          Last Post CarlTrading  
          Working...
          X