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

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

    Order Flow VWAP

    Hi all,


    I.m trying to develop a strategy with the OrderFlowVWAP indicator. And i.m reading the documentation in the wiki:

    https://ninjatrader.com/support/help...flow_vwap2.htm

    But when i try the code on VISUAL STUDIO 2019 , it doesn.t work:

    Code:
    double VWAPValue = OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Three, 1, 2, 3).VWAP[0];
    It doesn.t recognize the function "OrderFlowVWAP(.........)". How can i use this indicator ? I recently upgrade my license and i have a full life time license.


    King regards,
    Last edited by Wargos; 07-29-2020, 12:36 PM.

    #2
    Hello Wargos,

    Thank you for the post.

    What is the specific error that you are seeing?

    I would otherwise suggest to attach the script you are using so that I can review the structure of the script and using statements. The indicator should be able to be used by using the sample from the help guide you linked to.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      The problem is that the code work when i use the NinjaScript Editor. But when i open the solution on Visual Studio, it doen.t recognice the line:

      Code:
       
       double VWAPValue = OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Three, 1, 2, 3).VWAP[0];
      Full code:

      Code:
      #region Using declarations
      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.ComponentModel.DataAnnotations;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Windows;
      using System.Windows.Input;
      using System.Windows.Media;
      using System.Xml.Serialization;
      using NinjaTrader.Cbi;
      using NinjaTrader.Gui;
      using NinjaTrader.Gui.Chart;
      using NinjaTrader.Gui.SuperDom;
      using NinjaTrader.Gui.Tools;
      using NinjaTrader.Data;
      using NinjaTrader.NinjaScript;
      using NinjaTrader.Core.FloatingPoint;
      using NinjaTrader.NinjaScript.Indicators;
      using NinjaTrader.NinjaScript.DrawingTools;
      #endregion
      
      //This namespace holds Strategies in this folder and is required. Do not change it. 
      namespace NinjaTrader.NinjaScript.Strategies
      {
          public class VWAP21 : Strategy
          {
              protected override void OnStateChange()
              {
                  if (State == State.SetDefaults)
                  {
                      Description                                    = @"Enter the description for your new custom Strategy here.";
                      Name                                        = "VWAP21";
                      Calculate                                    = Calculate.OnEachTick;
                      EntriesPerDirection                            = 1;
                      EntryHandling                                = EntryHandling.AllEntries;
                      IsExitOnSessionCloseStrategy                = true;
                      ExitOnSessionCloseSeconds                    = 30;
                      IsFillLimitOnTouch                            = false;
                      MaximumBarsLookBack                            = MaximumBarsLookBack.TwoHundredFiftySix;
                      OrderFillResolution                            = OrderFillResolution.Standard;
                      Slippage                                    = 0;
                      StartBehavior                                = StartBehavior.WaitUntilFlat;
                      TimeInForce                                    = TimeInForce.Gtc;
                      TraceOrders                                    = false;
                      RealtimeErrorHandling                        = RealtimeErrorHandling.StopCancelClose;
                      StopTargetHandling                            = StopTargetHandling.PerEntryExecution;
                      BarsRequiredToTrade                            = 20;
                      // Disable this property for performance gains in Strategy Analyzer optimizations
                      // See the Help Guide for additional information
                      IsInstantiatedOnEachOptimizationIteration    = true;
                  }
                  else if (State == State.Configure)
                  {
                  }
              }
      
              protected override void OnBarUpdate()
              {
      
                  double VWAPValue = OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures ETH"), VWAPStandardDeviations.Three, 1, 2, 3).VWAP[0];
                  Print("The current VWAP with a standard resolution on CME US Index Futures RTH is " + VWAPValue.ToString());
      
              }
          }
      }

      Comment


        #4
        Hello Wargos,

        Thank you for clarifying that.

        Visual studio does not have intellesense for this indicator as it is not included as source code so what you are seeing is correct. It will still compile it is just not able to pull that from the NinjaTrader custom project.

        You can manually include the NinjaTrader.Vendor.cs file in the visual studio solution however it will be removed every time you make changes in the ninjascript project.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I.m trying but still doesn.t compile on Visual Studio.The error i get is:

          CS1955 C# Non-invocable member cannot be used like a method.

          Comment


            #6
            Hello Wargos,

            Visual studio will not be able to compile in any use case, it is just being used as a text editor here. If the platform compiles in the NinjaScript editor then the syntax would be correct.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              > You can manually include the NinjaTrader.Vendor.cs file in the visual studio solution however it will be removed every time you make changes in the ninjascript project.

              That worked for me - hope I won't have to add it too many times - thanks

              Comment


                #8
                // This compiles in VS2022
                // Will post back if it does not yield VWAP seies

                var hours = "CME US Index Futures ETH";
                var OFVWAP = new OrderFlowVWAP();
                var VWAPObject = OFVWAP.OrderFlowVWAP(Input, VWAPResolution.Standard, TradingHours.String2TradingHours(hours), VWAPStandardDeviations.Three, 1, 2, 3);
                PlotVWAP[0] = VWAPObject.VWAP[0];

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Stanfillirenfro, Yesterday, 09:19 AM
                7 responses
                51 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by TraderCro, 04-12-2024, 11:36 AM
                4 responses
                69 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Mindset, Yesterday, 02:04 AM
                1 response
                15 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by agclub, 04-21-2024, 08:57 PM
                4 responses
                18 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by Irukandji, Today, 04:58 AM
                0 responses
                6 views
                0 likes
                Last Post Irukandji  
                Working...
                X