Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

VWAP reset interval in weeks

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

    VWAP reset interval in weeks

    Hi guys!

    I'm very not a developper... I want my VWAP it in weeks and not in sessions, someone can help me with this line :

    OrderFlowVWAP(VWAPResolution.Standard, TradingHours, VWAPStandardDeviations.Three, 1, 2, 3);

    Thanks in advance!

    #2
    Hi Acrux, thanks for your question.

    This would be done by adding a Weekly data series to your script and applying that data series to your OrderFlowVWAP indicator.

    We have a guide on multi time frame and instrument scripts here:


    e.g.

    Code:
    namespace NinjaTrader.NinjaScript.Indicators
    {
        public class WeeklyVWAP : Indicator
        {
            private OrderFlowVWAP _WOF;
    
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    //...
                }
                else if (State == State.Configure)
                {
                    AddDataSeries(Data.BarsPeriodType.Tick, 1);
                    AddDataSeries(Data.BarsPeriodType.Week, 1);
                }
                else if (State == State.DataLoaded)
                {
                    _WOF = OrderFlowVWAP(BarsArray[2], VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Three, 1, 2, 3);
                }
            }
    
            protected override void OnBarUpdate()
            {
                if(BarsInProgress != 0)
                {
                    return;
                }
    
                if(CurrentBars[2] < 1) 
                {
                    return;
                }
    
                Print(_WOF.VWAP[0]);
            }
        }
    }
    Please let me know if I can assist any further.

    Comment


      #3
      Hello guys!

      I tried the code as Chris suggested. But I'm not getting the exact same values that I get when I load the VWAP indicator on chart when I print the values on the Output Window if I use the code inside a strategy. The code I'm using inside the script is this one:

      Code:
      VWAP = OrderFlowVWAP(BarsArray[1],VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Two, 1, 2, 3).VWAP[0];
      VWAP_High_2 = OrderFlowVWAP(BarsArray[1],VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Two, 1, 2, 3).StdDev2Upper[0];
      VWAP_Low_2 = OrderFlowVWAP(BarsArray[1],VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Two, 1, 2, 3).StdDev2Lower[0];
      VWAP_High_1 = OrderFlowVWAP(BarsArray[1],VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Two, 1, 2, 3).StdDev1Upper[0];
      VWAP_Low_1 = OrderFlowVWAP(BarsArray[1],VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Two, 1, 2, 3).StdDev1Lower[0];
      
      Print("VWAP: "+VWAP);
      Print("VWAP_High_2: " + VWAP_High_2);
      Print("VWAP_Low_2: " + VWAP_Low_2);
      Print("VWAP_High_1: " + VWAP_High_1);
      Print("VWAP_Low_1: " + VWAP_Low_1);

      I already load the Weekly dataseries as suggested, so I call it on BarsArray[1].

      Please let me know what I'm doing wrong.

      Comment


        #4
        Hi facuevasm, thanks for posting.

        Is your chart indicator VWAP applied to a weekly series and are the parameters exactly the same? I would need to see screenshots of exactly what you are doing to identify why you are not seeing the same values show up.

        Best regards,
        -ChrisL

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        39 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        64 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 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