Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OrderFlow VWAP BarsAgo Error

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

    OrderFlow VWAP BarsAgo Error

    hello,
    I try to use VWAP in my strategy.
    But I don´t know where is the mistake.
    when I run the strategy appears an error:
    Strategy 'myVWBSAEK': Error on calling 'OnBarUpdate' method on bar -1: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
    Attached Files

    #2
    Hello, thanks for writing in.

    You should run the code in the primary series only, and also make sure there are bars in both the primary and secondary series:

    Code:
            protected override void OnBarUpdate()
            {
                if (BarsInProgress != 0)
                    return;
                if(CurrentBars[0] < 400 || CurrentBars[1] < 400)
                    return;​

    Comment


      #3
      solved, thanks

      Comment


        #4
        Another question:
        Is possible to calculate VWAP onBarClose and avoid to use a a secondary bars series using ticks.?

        Comment


          #5
          Hi, The only way to use the OrderFlow VWAP is to use it with a 1 tick series, unfortunately, this is the only way it can be used.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          650 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          370 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          109 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          574 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          577 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X