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

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.
    Chris L.NinjaTrader Customer Service

    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
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        5 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,266 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X