Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Obtaining order flow VWAP value from additional data series within a strategy

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

    Obtaining order flow VWAP value from additional data series within a strategy

    Hi,

    I am developing a strategy which uses an additional data series. I want to be able to compare the position of the stock of the additional data series in relation to its order flow VWAP value.

    I have created a private double variable to store the value of the additional series order flow VWAP

    Code:
    private double additionalSeriesVwapVal;
    I have added the additional data series under State == State.Configure

    Code:
    AddDataSeries("ES 03-24", Data.BarsPeriodType.Minute, 5);
    I have added this code to OnBarUpdate()

    Code:
    if (BarsInProgress == 1)
        {
            additionalSeriesVwapVal = OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("US Equities RTH"), VWAPStandardDeviations.None, 1, 2, 3).VWAP[0];
        }​
    The problem I have is that the above line of code doesn't store the value from the order flow VWAP. I have tested capturing price data from the additional series by using Closes[1][0] and this works ok but for whatever reason I can't access the VWAp values.

    Is it not possible to use the order flow VWAP against an additional data series within a strategy? If it is possible, can you please provide me with some guidance.

    Thanks,

    Neil

    #2
    Hello Neil,

    Thank you for your post.

    You mentioned that the line of code doesn't store the value from the Order Flow VWAP. What value do you see in the output if you add a Print? For example:
    Code:
    if (BarsInProgress == 1)
    {
    Print(Time[0] + " BarsInProgress: " + BarsInProgress + " storing VWAP value: " + OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("US Equities RTH"), VWAPStandardDeviations.None, 1, 2, 3).VWAP[0]);
    additionalSeriesVwapVal = OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("US Equities RTH"), VWAPStandardDeviations.None, 1, 2, 3).VWAP[0];
    Print("VWAP value stored. additionalSeriesVwapVal: " + additionalSeriesVwapVal);
    }​​
    "Is it not possible to use the order flow VWAP against an additional data series within a strategy?"
    Yes, it is possible. There is syntax available that lets you specify the input series. You could use Closes[1][0] as you mentioned, or you could specify the BarsArray. For example:
    OrderFlowVWAP(ISeries<double> input, VWAPResolution resolution, TradingHours tradingHoursInstance, VWAPStandardDeviations numStandardDeviations, double sD1Multiplier, double sD2Multiplier, double sD3Multiplier)
    OrderFlowVWAP(BarsArray[1], VWAPResolution.Standard, BarsArray[1].TradingHours, VWAPStandardDeviations.Three, 1, 2, 3)

    This syntax information is listed in the help guide page here:


    Please let us know if we may be of further assistance.

    Comment


      #3
      NinjaTrader_Emily, thanks for your help, I've got it to work now. By mistake I had
      Code:
      if (BarsInProgress != 0) return;
      as my first line in OnBarUpdate() which was preventing me access the additional data series.

      Neil
      Last edited by burtoninlondon; 02-08-2024, 01:44 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      131 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X