Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Export data to CSV up-tick and down-Tick

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

    Export data to CSV up-tick and down-Tick

    Dear sir.
    I would like to export data values from ES chart 1min on bar close. Time+OHLC+Volume and Up/Down-Tick
    I have used Buy Sell volume indicator to obtain the contract in the (up/down tick values) and SampleStramWriter indicator to write TXT file.
    My problem: If I insert the indicator SampleStramWriter in the chart as OnBarClose. The up/down tick data is not exported.
    If i insert the indicator SampleStramWriter such as OnEachTick the values are exported (I don't wanna this information).
    How can I solve this?

    Attached you can find the indicator that I'm using.
    Attached Files

    #2
    Hello memonic,

    Thank you for the post.

    One note here is that the BuySellVolume is updating the last plot value on the first tick of each bar. Without using OnEachTick that indicator would not work correctly because it is expecting OnEachTick logic.

    For your indicator if you wanted to use it OnBarClose while using the BuySellVolume you could instead use OnEachTick and then simulate an OnBarUpdate by using IsFirstTickOfBar: https://ninjatrader.com/support/help...FirstTickOfBar

    That would likely work best in this case because of how the BuySellVolume logic works. You could alternatively take the existing logic the BuySellVolume and re use that: if (CurrentBar != activeBar)

    I look forward to being of further assistance.

    Comment


      #3
      Hello Jesse.

      The results are the same:

      12/10/2020 0:25:00,3471.75,3471.75,3471.75,3471.75,1,0,0,0
      12/10/2020 0:26:00,3472.25,3472.25,3472.25,3472.25,1,0,0,0
      12/10/2020 0:27:00,3471.75,3471.75,3471.75,3471.75,1,0,0,0
      12/10/2020 0:28:00,3472.25,3472.25,3472.25,3472.25,1,0,0,0

      attached you can find the indicator with the suggestion.
      thanks
      Attached Files

      Comment


        #4
        Hello memonic,

        In this case you are referencing the current bar which is the new bar so the values would be 0, it also looks like that may be a historical bar which also should be 0.

        You could do the following to reference the plot in the same way which the BuySellVolume is accumulating the value. I removed the custom indicator from this code:

        Code:
        if(CurrentBar < 1)return;
        if (IsFirstTickOfBar)
        {
            sw = File.AppendText(path); // Open the path for writing
            sw.WriteLine(Time[0] + "," + Open[1] + "," + High[1] + "," + Low[1] + "," + Close[1] + "," + Volume[1]+ "," + BuySellVolume1.Sells[1] + "," + BuySellVolume1.Buys[1]);
            sw.Close(); // Close the file to allow future calls to access the file again.
        }
        In historical the value would be 0 because OnMarketData is not used historically. You can enable tick replay to allow it to be used historically.

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X