Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator import problem

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

    Indicator import problem

    Dear Support,

    I created a simple indicator that can display the Parabolic SAR in normal mode or as a horizontal line.
    I can compile it without any problems, and it works on the chart as well. I can export it as a zip file, but when I try to import the zip file on another computer, I get an error window.
    I have created several indicators before, and this is the first time I have encountered this error. Can you help me solve this problem?

    I paste the entire source code of the indicator.
    Code:
    namespace EA_Namespace
    {
        public enum EA_ParabolicMode : ushort{
           Egyenes_Parabolic = 0,
           Mozgo_Parabolic = 1
        }
    }
    
    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators
    {
        public class ParabolicEA : Indicator
        {
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description                                    = @"Enter the description for your new custom Indicator here.";
                    Name                                        = "ParabolicEA";
                    Calculate                                    = Calculate.OnBarClose;
                    IsOverlay                                    = true;
                    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                    = false;
                    
                    CandleCount                                    = 1000;
                    ParabolicMode                                 = EA_Namespace.EA_ParabolicMode.Egyenes_Parabolic;
                    ParabolicAcceleration                         = 0.02;
                    ParabolicAccelerationMax                     = 0.2;
                    ParabolicAccelerationStep                     = 0.02;
                    //ParabolicColor                                 = Brushes.Yellow;
                    
                    AddPlot(new Stroke(Brushes.Azure, DashStyleHelper.Solid, 1, 50), PlotStyle.Dot, "Parabolic_Long");
                    AddPlot(new Stroke(Brushes.Azure, DashStyleHelper.Solid, 1, 50), PlotStyle.Dot, "Parabolic_Short");
                }else if (State == State.Configure){
                    
                }
            }
    
            protected override void OnBarUpdate()
            {
                int candle_index = Bars.Count - CurrentBar - 1;
                if(candle_index < CandleCount && candle_index < Bars.Count - 3){
                    //PlotBrushes[0][0] = ParabolicColor;
                    //PlotBrushes[1][0] = ParabolicColor;
                    
                    double value_0 = ParabolicSAR(ParabolicAcceleration, ParabolicAccelerationMax, ParabolicAccelerationStep)[0];
                    double value_1 = ParabolicSAR(ParabolicAcceleration, ParabolicAccelerationMax, ParabolicAccelerationStep)[1];
                    double open_0 = Open[0];
                    double open_1 = Open[1];
                    double close_0 = Close[0];
                    double close_1 = Close[1];
                    
                    int dir_0 = 0;
                    if(value_0 < Math.Min(open_0, close_0)){
                        dir_0 = 1;
                    }else if(value_0 > Math.Max(open_0, close_0)){
                        dir_0 = -1;
                    }
                    
                    int dir_1 = 0;
                    if(value_1 < Math.Min(open_1, close_1)){
                        dir_1 = 1;
                    }else if(value_1 > Math.Max(open_1, close_1)){
                        dir_1 = -1;
                    }
                    
                    
                    if(dir_0 != dir_1){
                        if(dir_0 == 1){
                            Parabolic_Long[0] = value_0;
                            Parabolic_Short[0] = Double.NaN;
                        }else{
                            Parabolic_Short[0] = value_0;
                            Parabolic_Long[0] = Double.NaN;
                        }
                    }else{
                        if(ParabolicMode == EA_Namespace.EA_ParabolicMode.Egyenes_Parabolic){
                            if(dir_0 == 1){
                                Parabolic_Long[0] = Parabolic_Long[1];
                                Parabolic_Short[0] = Double.NaN;
                            }else if(dir_0 == -1){
                                Parabolic_Long[0] = Double.NaN;
                                Parabolic_Short[0] = Parabolic_Short[1];
                            }
                        }else{
                            if(dir_0 == 1){
                                Parabolic_Long[0] = value_0;
                                Parabolic_Short[0] = Double.NaN;
                            }else{
                                Parabolic_Short[0] = value_0;
                                Parabolic_Long[0] = Double.NaN;
                            }
                        }
                    }
                }
            }
            
            [NinjaScriptProperty]
            [Display(Name="Gyertya Db", Description="Ennyi Gyertyába Rajzoljuk", Order=1, GroupName="Parameters")]
            public int CandleCount
            { get; set; }
            
            [NinjaScriptProperty]
            [Display(Name="Parabolic Módszer", Description="Így rajzoljuk a parabolicot", Order=2, GroupName="Parameters")]
            public EA_Namespace.EA_ParabolicMode ParabolicMode
            { get; set; }
            
            [NinjaScriptProperty]
            [Display(Name="Parabolic Acceleration", Description="Parabolic Acceleration", Order=3, GroupName="Parameters")]
            public double ParabolicAcceleration
            { get; set; }
            
            [NinjaScriptProperty]
            [Display(Name="Parabolic Acceleration Max", Description="Parabolic Acceleration Max", Order=4, GroupName="Parameters")]
            public double ParabolicAccelerationMax
            { get; set; }
            
            [NinjaScriptProperty]
            [Display(Name="Parabolic Acceleration Step", Description="Parabolic Acceleration Step", Order=5, GroupName="Parameters")]
            public double ParabolicAccelerationStep
            { get; set; }
            
            /*
            [NinjaScriptProperty]
            [Display(Name="Parabolic Szin", Description="Parabolic Szin", Order=6, GroupName="Parameters")]
            public Brush ParabolicColor
            { get; set; }
            */
            
            
            [Browsable(false)]
            [XmlIgnore]
            public Series<double> Parabolic_Long
            {
                get { return Values[0]; }
            }
    
            [Browsable(false)]
            [XmlIgnore]
            public Series<double> Parabolic_Short
            {
                get { return Values[1]; }
            }
            
        }
    }​
    Egyenes_Parabolic = Horizontal Parabolic

    The error message:
    error message

    Finally I attach the zip the Ninjatrader generated.

    Laszlo

    #2
    Hello wenn34,

    I see the script has a custom namespace with enums.

    Are these enums in another file that is already imported on the other machine?

    May I test the exported file on my end?
    If so, please attach the exported .zip to your next post.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi ChelseaB

      The namespace is unique so I think it won't be the problem.
      I attached the zip file to my first post, now I try it again.
      ParabolicEA.zip

      Laszlo

      Comment


        #4
        Hello Laszlo,

        The export you have provided is an assembly dll so I would not be able to review the code and provide direction. Further, due to our policy and security we are not able to import assembly dll files from users.

        May I have an open source export of the script? (When exporting do not click the 'Export as compiled assembly' checkbox)
        If you are not wanting to share the logic, you can make a copy of the script and remove the logic from OnBarUpdate() and then export the copy.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          Sorry for the wrong format, now I can send it again.
          I hope you can answer my question.

          Laszlo
          ParabolicEA.zip

          Comment


            #6
            Hello wenn34,

            Thank you for the file.

            When exporting this as an assembly and attempting to import I am seeing the following error on the Log tab of the Control Center.
            Error compiling import assembly: C:\Users\NinjaTrader_ChelseaB\Documents\NinjaTrade r 8\bin\Custom\ParabolicEA.cs(49,271): error CS0117: 'ParabolicEA' does not contain a definition for 'ParabolicColor'

            Are you seeing this error on your end when attempting to import the assembly?

            ​On lines 157 to 162 I am seeing that multi-line comments have been used which is causing this issue.

            The import / export process uses reflection and regular expressions to confirm dependencies. The process will only able to ignore lines which start with single line comment marks.

            Using block comments or multi-line comments /* */ on a public input or a method will cause the regex to read the text there, and interpret is as that there should be this public property or a method that the reflection is unable to see.

            To prevent the error, comment out declarations and variable names (within the logic) with single line comment lines.

            //[NinjaScriptProperty]
            //[Display(Name="Parabolic Szin", Description="Parabolic Szin", Order=6, GroupName="Parameters")]
            //public Brush ParabolicColor
            //{ get; set; }​
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            605 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            351 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            561 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X