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 NullPointStrategies, Today, 05:17 AM
            0 responses
            52 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            70 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            43 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            48 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X