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

can't load indicator

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

    can't load indicator

    I am currently trying to load a custom indicator.

    I right-clicked on indicators in the ninjascript editor and clicked to select "New indicator". I then copied over code for an existing indicator and saved it.

    But when I try to load it I can't select it. Do I have to do something special to be able to load it?
    Attached Files

    #2
    Hello majoraspberry,

    I would suggest, deleting the current instance you copied over and instead, opening the indicator you’d like to copy in the editor, right clicking in the editor and selecting Save As, then naming the file. The file should now appear.

    Copy and pasting code in a new file is not suggested for simply duplicating an indicator.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi there,

      Thank you for getting back to me. I deleted the copy/paste code as you suggested and just went through the wizard to generate a new indicator. However, I still cannot see the indicator under available indicators for the chart. Do I have to import it or something?

      Thanks!

      Comment


        #4
        The code it generated is here:

        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.DrawingTools;
        #endregion
        
        //This namespace holds Indicators in this folder and is required. Do not change it. 
        namespace NinjaTrader.NinjaScript.Indicators
        {
            public class HMAC : Indicator
            {
                protected override void OnStateChange()
                {
                    if (State == State.SetDefaults)
                    {
                        Description                                    = @"A multi-colored version of HMAC.";
                        Name                                        = "HMAC";
                        Calculate                                    = Calculate.OnBarClose;
                        IsOverlay                                    = false;
                        DisplayInDataBox                            = true;
                        DrawOnPricePanel                            = true;
                        DrawHorizontalGridLines                        = true;
                        DrawVerticalGridLines                        = true;
                        PaintPriceMarkers                            = true;
                        ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                        //Disable this property if your indicator requires custom values that cumulate with each new market data event. 
                        //See Help Guide for additional information.
                        IsSuspendedWhileInactive                    = true;
                    }
                    else if (State == State.Configure)
                    {
                    }
                }
        
                protected override void OnBarUpdate()
                {
                    //Add your custom indicator logic here.
                }
            }
        }
        
        #region NinjaScript generated code. Neither change nor remove.
        
        namespace NinjaTrader.NinjaScript.Indicators
        {
            public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
            {
                private HMAC[] cacheHMAC;
                public HMAC HMAC()
                {
                    return HMAC(Input);
                }
        
                public HMAC HMAC(ISeries<double> input)
                {
                    if (cacheHMAC != null)
                        for (int idx = 0; idx < cacheHMAC.Length; idx++)
                            if (cacheHMAC[idx] != null &&  cacheHMAC[idx].EqualsInput(input))
                                return cacheHMAC[idx];
                    return CacheIndicator<HMAC>(new HMAC(), input, ref cacheHMAC);
                }
            }
        }
        
        namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
        {
            public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
            {
                public Indicators.HMAC HMAC()
                {
                    return indicator.HMAC(Input);
                }
        
                public Indicators.HMAC HMAC(ISeries<double> input )
                {
                    return indicator.HMAC(input);
                }
            }
        }
        
        namespace NinjaTrader.NinjaScript.Strategies
        {
            public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
            {
                public Indicators.HMAC HMAC()
                {
                    return indicator.HMAC(Input);
                }
        
                public Indicators.HMAC HMAC(ISeries<double> input )
                {
                    return indicator.HMAC(input);
                }
            }
        }
        
        #endregion

        Comment


          #5
          Hello majoraspberry,

          Did you open the indicator you're looking to copy in the NS editor, right click in the editor>save as>and label the new name?

          You may need to right click in the editor after creating the file and >compile, before the indicator is displayed.

          Please let us know if you need further assistance.
          Alan P.NinjaTrader Customer Service

          Comment


            #6
            You're right, I had to compile it for it to show up. Thank you!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by sofortune, Yesterday, 11:48 AM
            2 responses
            22 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by Zach55, 02-19-2024, 07:22 PM
            2 responses
            54 views
            0 likes
            Last Post lbadisa1  
            Started by JGriff5646, Today, 05:47 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by AlphaOptions, 06-18-2013, 08:24 AM
            9 responses
            2,200 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by ttrader23, Today, 09:33 AM
            3 responses
            23 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X