Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Flow Cumulative Delta error

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

    Order Flow Cumulative Delta error

    I'm trying to use Order Flow Cumulative Delta indicator in my strategy, following the documentation here.
    I'm calling the OrderFlowCumulativeDelta() method by reference, cumulativeDelta.

    I wish the syntax was explained. It's hard to discern what the params are.

    My strategy has 3 data series:
    • Primary (0): 15sec
    • 1-second (1)
    • 1-tick (2)
    When I follow what is in the documentation, I get "Error on calling 'OnBarUpdate' method on bar -1: Index was outside the bounds of the array" because of using cumulativeDelta.BarsArray[2] instead of just BarsArray[2].

    Code:
    cumulativeDelta.Update(cumulativeDelta.BarsArray[2].Count - 1, 1);
    This is the only code that works for me:

    Code:
    cumulativeDelta.Update(BarsArray[2].Count - 1, 1);
    But that's confusing because I thought your documentation uses referenceName.BarsArray[X] because that specifies which of the indicator's internal BarsArray to update... Maybe I'm wrong.

    Any help would be appreciated. Thanks!!
    ​

    #2
    Hello iantriestrading,

    As long as you copied and pasted the syntax exactly as shown in the help guide that will be the correct structure however your 1 tick series is being added in the wrong order so it won't match the sample directly. In your case you would need to use BarsInProgress 2 for the condition that calls Update and pass BarsArray[2] to the update method.

    Comment


      #3
      Hey Jesse,

      So you mean this, right?

      Code:
      if (BarsInProgress == 2) {
          cumulativeDelta.Update(BarsArray[2].Count - 1, 1);​
      }

      Comment


        #4
        Hello iantriestrading,

        Right.

        The primary series is always BIP 0, the first added series would be 1 so the tick series which is second added in your script is 2.

        The orderflow items rely on being called for the tick series and the series you want to use it with. The sample shows how to do that while adding just a tick series so that would be index 1. In your script you have an additional series so that would be index 2 in that use case.

        Comment


          #5
          Thanks Jesse!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          45 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          21 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          31 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          50 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          42 views
          0 likes
          Last Post CarlTrading  
          Working...
          X