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 Mindset, 04-21-2026, 06:46 AM
          0 responses
          95 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          140 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          68 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          125 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          75 views
          0 likes
          Last Post PaulMohn  
          Working...
          X