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

Order Flow VWAP syntax

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

    Order Flow VWAP syntax

    Using Order Flow Cumulative Delta in an strategy, code running ok is

    else if (State == State.DataLoaded)
    {
    cumulativeDelta = OrderFlowCumulativeDelta(CumulativeDeltaType.BidAs k, CumulativeDeltaPeriod.Bar, 0);
    }

    Can you please tell me what is the correct syntax for using Order Flow VWAP? I just want create conditions like Close[1] < OrderFlowVWAP[1]...

    I have read https://ninjatrader.com/support/help...flow_vwap2.htm but none of lines I have used works.

    Thanks a lot
    Last edited by Impeesa; 09-28-2020, 01:44 AM.

    #2
    Hello Impeesa,

    Thanks for your post.

    The help guide link you provided shows the syntax for specifying the various OrderFlow VWAP indicator plots from VWAP to StdDevUpper3 and StdDevLower3.

    The link also provides an example of use and shows printing the VWAP value itself.

    // Prints the VWAP value using a standard resolution off of RTH trading hours
    double VWAPValue = OrderFlowVWAP(VWAPResolution.St andard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Three, 1, 2, 3).VWA P[0];
    Print("The current VWAP with a standard resolution on CME US Index Futures RTH is " + VWAPValue.ToString());


    If you are looking to shorten all that up with a private instance of the indicator then you can approach like this:

    At the class level: private OrderFlowVWAP myOFVWAP;

    In State.DataLoaded: myOFVWAP = OrderFlowVWAP(VWAPResolution.Tick, Bars.TradingHours, VWAPStandardDeviations.Three, 1, 2, 3);

    In OnBarUpdate(): Close[1] < myOFVWAP.VWAP[1];

    Please note that you will have to segrgate by BarsInProgress to ensure that the VWAP indicator is updated with the added tick series. It would look like this:

    else if (BarsInProgress == 1)
    {
    // We have to update the secondary tick series of the cached indicator using Tick Resolution to make
    // sure the values we get in BarsInProgress == 0 are in sync
    myOFVWAP.Update(BarsArray[1].Count -1, 1);
    }
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      It works perfectly.

      Thanks a lot, Paul

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Brevo, Today, 01:45 AM
      0 responses
      6 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      3 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      242 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      6 views
      0 likes
      Last Post oviejo
      by oviejo
       
      Working...
      X