Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Questions on pulling orderflow data from additional data series

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

    Questions on pulling orderflow data from additional data series

    Hello, I have 2 questions. I have the following code:
    Code:
    else if (State == State.Configure)
                {
                    AddVolumetric(null, BarsPeriodType.Range, 26, VolumetricDeltaType.BidAsk, 1);
                }​
    and
    Code:
    #region Volumetric Setup
                if (Bars == null)
                      return;
                NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType barsType = Bars.BarsSeries.BarsType as    
                NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType;
                if (barsType == null)
                      return;
                #endregion
    
                i = 0;
                entropy_counter = 0;
                while (i <= Bars_Lookback)
                {
                    delta = barsType.Volumes[CurrentBar - i].BarDelta;
                    if ((Open[1][i] < Close[1][i]) && (delta < 0))
                    {
                        entropy_counter = entropy_counter + 1;
                    }
    
                    else if ((Open[1][i] > Close[1][i]) && (delta > 0))
                    {
                        entropy_counter = entropy_counter + 1;
                    }
                    i = i+1;
                }​
    First question: When I try to compile, it returns Cannot apply indexing with [] to an expression of type 'double' for both the "if statements". However, the "i" variable is declared as an integer, and stays an integer throughout the program. Maybe I am calling the additional data series incorrectly?

    Second question: in the line
    delta = barsType.Volumes[CurrentBar - i].BarDelta;
    , how would I pull the additional data series' bar delta instead of the primary chart data series' delta? The primary data series I am using for this chart is not a volumetric chart, however through some testing I found it is in fact pulling the bar delta for the primary data series instead of the additional volumetric data series.

    Thank you,

    Ryan Beckmann

    #2


    Open[1] will return one bar back the open price of the main data series from the chart which is a double and that is why you get the error. You need an s on the end to get the array of series:
    Opens[1][i]


    So you could try:

    while (i <= Bars_Lookback)
    {
    delta = barsType.Volumes[CurrentBar - i].BarDelta;
    if ((Opens[1][i] < Closes[1][i]) && (delta < 0))
    {
    entropy_counter = entropy_counter + 1;
    }

    else if ((Opens[1][i] > Closes[1][i]) && (delta > 0))
    {
    entropy_counter = entropy_counter + 1;
    }
    i = i+1;
    }​​​


    Hope that helps.​

    Comment


      #3
      Second question: in the line
      delta = barsType.Volumes[CurrentBar - i].BarDelta;
      , how would I pull the additional data series' bar delta instead of the primary chart data series' delta? The primary data series I am using for this chart is not a volumetric chart, however through some testing I found it is in fact pulling the bar delta for the primary data series instead of the additional volumetric data series.​



      NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;
      barDelta= barsType.Volumes[CurrentBar].BarDelta;

      Print(barDelta.ToString());

      that should give you the bar delta from the Volumetric bars.

      Hope that helps.​

      Comment


        #4
        Hello rbeckmann05,

        Thank you for your post.

        For your first question, eirwin1971 is providing good information on using Opens[] and Closes[].

        For your second question, to make sure you are pulling the barDelta value from your added Volumetric series, add a BarsInProgress check.

        BarsInProgress - https://ninjatrader.com/support/help...inprogress.htm

        BarsInProgress = 1 is your added data series.

        Also, please note that when adding multiple series, you will need to use BarsArray object with the corresponding index when casting the barsType.

        NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe barsType = BarsArray[1].BarsType as NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsTy pe;

        https://ninjatrader.com/support/help.../barsarray.htmm

        Please let me know if you have any other questions.

        Comment


          #5
          Thank you eirwin1971 and NinjaTrader_Gaby, was able to finish it up. Much appreciated to you especially eirwin, not a lot of people would take unpaid time out of their day to help out to that extent. Best of luck to you!

          Best regards,

          Ryan Beckmann

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X