Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to add VWAP StdDev lines to my strategy

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

    How to add VWAP StdDev lines to my strategy

    Hi NT8,

    I am trying to add the VWAP line and the standard deviation lines from it (1,2,3) to my strategy as plot lines for entry criteria. having trouble from the help guide in determining what it needs to look like in the strategy in these following locations:

    public class StrategyName : Strategy
    {
    private ChaikinOscillator ChaikinOscillator1;
    private (VWAP code for second standard deviation (under the VWAP line) here)
    }

    ...

    else if (State == State.DataLoaded)
    {
    ChaikinOscillator1 = ChaikinOscillator(Close, 3, 10);
    (VWAP code for second standard deviation (under the VWAP line) here)
    }

    ...

    if ( Close[0] crosses above (VWAP code for second standard deviation (under the VWAP line) here)
    )
    {
    EnterLongLimit(1, GetCurrentBid(0), @"1");
    }



    ​​​​​​​Thank you

    #2
    Hello Austiner87,

    Below is a link to the help guide on the Order Flow VWAP with sample code.
    https://ninjatrader.com/support/help...flow_vwap2.htm

    From the help guide:
    Code:
    // OnBarUpdate() logic
    
    if (BarsInProgress == 0)
    {
    // Prints the VWAP value using a standard resolution off of RTH trading hours
    double VWAPValue = OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Three, 1, 2, 3).VWAP[0];
    Print("The current VWAP with a standard resolution on CME US Index Futures RTH is " + VWAPValue.ToString());
    }
    From here VWAPValue can be used as the price for a CrossAbove.
    if (CrossAbove(Close, VWAPValue, 1))

    Or if you want to cross the series you could assign the indicator to a variable for easy access.
    Code:
    private OrderFlowVWAP OFVWAP;
    Code:
    OFVWAP = OrderFlowVWAP(VWAPResolution.Standard, Bars.TradingHours, VWAPStandardDeviations.Three, 1, 2, 3);
    Code:
    if (CrossAbove(Close, OFWVAP.VWAP, 1))
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ChelseaB, extremely helpful, thank you,

      can you please help me understand how I can reference each standard deviation of the VWAP. For instance, if I wanted to use the code:

      if (Close[0] > OFVWAP.VWAP[0] // If price of last bar is greater than VWAP value of last bar - But how to make this one of the StdDev instead of the VWAP line itself?


      Thank you!

      Comment


        #4
        Hello Austiner87,

        See the syntax in the help guide page linked below.


        Use the .StdDev1Upper[barsAgo index] series or one of the other series listed in the syntax signatures.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X