Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using ATR and OrderFlowVWAP indicator same time

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

    Using ATR and OrderFlowVWAP indicator same time

    A Strategy with two indicators, one lives inside Custom.dll and the other inside Vendor.dll (Same namespace and Class Name)

    HTML Code:
    extern alias custom;
    using System;
    using System.Diagnostics;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript.Indicators;
    
    namespace NinjaTrader.NinjaScript.Strategies
    {
        public class StrategyTest : Strategy
        {
            private OrderFlowVWAP vwap;
            private custom::NinjaTrader.NinjaScript.Indicators.ATR atr;
    
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Name = "StrategyTest";
                }
                else if (State == State.DataLoaded)
                {
                    atr = new custom::NinjaTrader.NinjaScript.Indicators.ATR()
                    {
                        Period = 14
                    };
                    vwap = OrderFlowVWAP(VWAPResolution.Standard, Bars.TradingHours, VWAPStandardDeviations.Three, 1, 2, 3);
    
                    AddChartIndicator(vwap);
                    AddChartIndicator(atr);
                }
           }
       }
    }
    Only OrderFlowVWAP is loaded, the ATR still loading...

    The code is correct?

    Thanks

    #2
    Hi Rudmax,

    replace private custom::NinjaTrader.NinjaScript.Indicators.ATR atr; with

    private ATR atr;

    and

    instead of

    atr = new custom::NinjaTrader.NinjaScript.Indicators.ATR() { Period = 14 };
    write in your (State == State.DataLoaded)

    atr = ATR(14);

    then it should work.

    hopefully I've helped you.

    regards Tradeer

    Comment


      #3
      Originally posted by Tradeer View Post
      Hi Rudmax,

      replace private custom::NinjaTrader.NinjaScript.Indicators.ATR atr; with

      private ATR atr;

      and

      instead of

      atr = new custom::NinjaTrader.NinjaScript.Indicators.ATR() { Period = 14 };
      write in your (State == State.DataLoaded)

      atr = ATR(14);

      then it should work.

      hopefully I've helped you.

      regards Tradeer
      Nops, ATR reside on Strategy Class at Custom.dll not in Strategy class at Vendor.dll wich has also a Strategy class... In this example, I extend Strategy at Vendor.dll. There are no ATR method at there.
      Last edited by Rudmax; 05-09-2020, 12:36 PM.

      Comment


        #4
        Hi Rudmax, thanks for your question.

        The only thing that is needed to access code from a dll is a reference to the DLL from Right click>References in the NinjaScript editor. To use an OrderFlow+ indicator within a script, you must add a 1 tick series to the script because the OrderFlow scripts also add a 1 tick series. e.g., in State.Configure:

        AddDataSeries(BarsPeriodType.Tick, 1);

        Please let me know if I can assist any further.

        Comment


          #5
          Originally posted by NinjaTrader_ChrisL View Post
          Hi Rudmax, thanks for your question.

          The only thing that is needed to access code from a dll is a reference to the DLL from Right click>References in the NinjaScript editor. To use an OrderFlow+ indicator within a script, you must add a 1 tick series to the script because the OrderFlow scripts also add a 1 tick series. e.g., in State.Configure:

          AddDataSeries(BarsPeriodType.Tick, 1);

          Please let me know if I can assist any further.
          Thank you, It works on NinjaScript Editor, I was trying at Visual Studio...

          I will figure out how to using ATR and OrderFlowVWAP at Visual Studio sice Strategy exists in both Custom.dll and Vendor.dll

          ATR resides in Custom and OrderFlowVWAP is in Vendor.dll

          Click image for larger version  Name:	Anotação 2020-05-11 131924.jpg Views:	0 Size:	33.2 KB ID:	1099198
          Last edited by Rudmax; 05-11-2020, 10:26 AM.

          Comment


            #6
            Hello Rudmax,

            Attached is an example exported script that calls both the ATR and the OrderFlowVWAP indicators and compiles in NinjaTrader without issue. Any messages in Visual Studio can be ignored.
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            87 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            132 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            65 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            118 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            67 views
            0 likes
            Last Post PaulMohn  
            Working...
            X