Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

OrderFlowVWAP value not equal to Order Flow VWAP Indicator value

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

    OrderFlowVWAP value not equal to Order Flow VWAP Indicator value

    Hello. I'm playing around with the OrderFlowVWAP in my NinjaScript. I followed the example found here:
    https://ninjatrader.com/support/help...=orderflowvwap

    For some reason, following the example in the link above, my output isn't matching what the indicator shows. It's off by nearly 2 points. Below is a simplified version of my code, which is basically what is in the example. I would appreciate any assistance.

    Code:
    protected override void OnStateChange() {
        if (State == State.SetDefaults) {
            Description = @"";
            Name = "TradingBot";
            Calculate = Calculate.OnEachTick;
            EntriesPerDirection = 1;
            EntryHandling = EntryHandling.AllEntries;
            IsExitOnSessionCloseStrategy = false;
            ExitOnSessionCloseSeconds = 30;
            IsFillLimitOnTouch = true;
            MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
            OrderFillResolution = OrderFillResolution.Standard;
            Slippage = 0;
            StartBehavior = StartBehavior.ImmediatelySubmit;
            TimeInForce = TimeInForce.Gtc;
            TraceOrders = false;
            RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
            StopTargetHandling = StopTargetHandling.PerEntryExecution;
            BarsRequiredToTrade = 20;
    
            IsInstantiatedOnEachOptimizationIteration = true;
        } else if (State == State.Configure) {
            AddDataSeries(Data.BarsPeriodType.Minute, 1);
            AddDataSeries(Data.BarsPeriodType.Tick, 1);
        }
    }
    
    protected override void OnBarUpdate() {
        if(BarsInProgress == 0) {
            if (IsFirstTickOfBar) {
                double VWAPValue = OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Three, 1, 2, 3).VWAP[0];
                Print(VWAPValue);
            }
        }
    
            if (BarsInProgress == 2) {
                OrderFlowVWAP(BarsArray[0], VWAPResolution.Tick, BarsArray[0].TradingHours, VWAPStandardDeviations.Three, 1, 2, 3)
                    .Update(OrderFlowVWAP(BarsArray[0], VWAPResolution.Tick, BarsArray[0].TradingHours, VWAPStandardDeviations.Three, 1, 2, 3).BarsArray[1].Count - 1, 1);
           }
    }
    Last edited by _jb__; 02-12-2021, 08:48 AM.

    #2
    Hello _jb_,

    Thank you for your post.

    I was unable to reproduce the behavior you are reporting. I have made an example script using the code provided and compared the prints in the Output window to the Order Flow VWAP indicator and the Data Box window and all values match. This is seen in the attached screenshot. Note that for values to match up, the Data Series Trading Hours property must match with the Trading Hours used in the indicator. Also, the Order Flow VWAP indicator Resolution and Trading Hours properties must match the custom indicator.

    Please test the attached example script using the same indicator and data series settings seen in the attached images. Are you still seeing different values when comparing the Output window, Chart window, and Data Box window?

    Let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Ahh that makes sense. I checked what I've been using and I've been using the default, "<Use Instrument Settings>". Is there somewhere on the chart where I can view what that refers to?

      Comment


        #4
        Hello _jb_,

        Thank you for your note.

        The Trading Hours template used by an instrument is seen in the Tools > Instruments window. In the Instruments window, search for the instrument you are using on the chart and double-click the instrument to view which Trading Hours template it uses.

        See the help guide documentation below for more information.
        Instruments - https://ninjatrader.com/support/help...nstruments.htm

        Please let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by yertle, Yesterday, 12:24 PM
        1 response
        10 views
        0 likes
        Last Post yertle
        by yertle
         
        Started by Mr Bread, Today, 04:25 AM
        2 responses
        9 views
        0 likes
        Last Post Mr Bread  
        Started by kandise, Today, 09:41 AM
        0 responses
        2 views
        0 likes
        Last Post kandise
        by kandise
         
        Started by Mubeen Haider, Today, 09:41 AM
        0 responses
        5 views
        0 likes
        Last Post Mubeen Haider  
        Started by nicbizz, Today, 09:02 AM
        0 responses
        7 views
        0 likes
        Last Post nicbizz
        by nicbizz
         
        Working...
        X