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

Log Error regarding an Indicator

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

    Log Error regarding an Indicator

    I thought I found the problem, but apparently I did not. The log is telling me that my McClellan Oscillator, an imported indicator, has an error:

    Failed to call method 'Initialize' for indicator 'McClellan Oscillator'; 'Add' method only accepts positive 'period' values, but was -1 Min

    The category is Default, so I am not to sure where to start looking to fix the error.

    I am using the McCOsc in several different strategies.

    Thank you in advance...

    #2
    Hello dunwoodyjr,
    Can you tell me does the McClellan Oscillator indicator is a multi series indicator. If so, can you tell, what exact code you have written to Add the the secondary data series.

    You can find the Add() method in the Initialize section of the indicator.

    I look forward to assisting you further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      HOw do you erase your past order entry information from being displayed on the chart screen?

      Comment


        #4
        Hello Camron,
        Please follow the instructions below to disable the plotting of trade executions.
        • Right click in your chart and select the menu "Data Series..."
        • Find the "Plot executions" parameter for each data series and change the value to "DoNotPlot"
        • Press the "OK" button

        See here for more information on working with Data Series > How to edit Data Series parameters:
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          In one strategy it looks like this:

          protected override void Initialize()
          {
          Add(TripMOMO(15, 25, 5));
          Add(EMA50vs200(200, 50));
          Add(RSI(12, 1));
          Add(EMA(eMA1st));
          Add(ADX(14));
          Add(EMA(eMA2nd));
          Add(EMA(50));
          Add(Bollinger(bBstandarddevside, 20));
          Add(McClellanOscillator(19,39));

          EMA(eMA1st).Plots[0].Pen.Color = Color.Blue;
          EMA(eMA2nd).Plots[0].Pen.Color = Color.Black;
          EMA(50).Plots[0].Pen.Color = Color.Green;
          McClellanOscillator(19,39).Plots[0].Pen.Color = Color.Chocolate;

          EntryHandling = EntryHandling.UniqueEntries;

          SetProfitTarget("Enter Short", CalculationMode.Percent, Closeshort);
          SetTrailStop("Enter Short", CalculationMode.Percent, Trailingshort, true);

          CalculateOnBarClose = true;
          }


          Thing is, I don't notice it effect the strategy. It compiles fine and runs well. I just keep getting about 15 errors each time I compile or run a back test...

          Comment


            #6
            Hello dunwoodyjr,
            Thank for the code. Unfortunately this is the code which you have used in the Initialize section of the strategy. I need the code of the initialize section of the McClellanOscillator indicator.

            In Control Center menu bar goto Tools>Edit NinjaScript>Indicators...
            In the Indicator dialog select McClellanOscillator and click on the Ok button.
            Please send the code of the Initialize section of the indicator.


            I look forward to assisting you further.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              {
              Add("NYSE_AD", BarsPeriod.Id, BarsPeriod.Value);
              Add(new Plot(Color.FromKnownColor(KnownColor.Lime), PlotStyle.Line, "McClellanUpper"));
              Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "McClellanLower"));

              Plots[0].Min = 0;
              Plots[1].Max = 0;

              DrawOnPricePanel = false;
              Overlay = false;
              }

              Sooo, I guess that the "NYSE_AD" is the cause. It does have negative values in it's series. How do I change the code to allow for negative values? Or can I? Thanks!!!

              Comment


                #8
                Hello,
                The default symbol in NinjaTrader for NYSE Advance decline is ADD.
                Please change the code
                Code:
                Add("[COLOR="Red"]NYSE_AD[/COLOR]", BarsPeriod.Id, BarsPeriod.Value);
                to
                Code:
                Add("ADD", BarsPeriod.Id, BarsPeriod.Value);
                Please let me know if I can assist you any further.
                JoydeepNinjaTrader Customer Service

                Comment


                  #9
                  Is there a library anywhere online that lists all the default symbols? Looking for NYSE Declines and others. Thanks!!

                  Comment


                    #10
                    Hello,
                    You can find it in the Instrument Manager.

                    In Control Center menu bar goto Tools>Instrument Manager

                    Please let me know if I can assist you any further.
                    JoydeepNinjaTrader Customer Service

                    Comment


                      #11
                      That did not work...

                      I changed the symbol (it was actually ^ADD). Still getting the error. Any other ideas. Thanks!

                      Comment


                        #12
                        Hello dunwoodyjr,
                        My apologies. Yes it will be ^ADD since it is an index.

                        Unfortunately dynamic adding of bars array is not supported at this point of time though it is in the lists of our future upgrade (tracker id #179).

                        Can you confirm if you change the indicator code as shown below then does your code works.

                        Please change
                        Code:
                        Add("NYSE_AD", BarsPeriod.Id, BarsPeriod.Value);
                        to
                        Code:
                        Add("^ADD", PeriodType.Minute, 5);
                        I look forward to assisting you further.
                        JoydeepNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by geddyisodin, 04-25-2024, 05:20 AM
                        8 responses
                        60 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by jxs_xrj, 01-12-2020, 09:49 AM
                        4 responses
                        3,287 views
                        1 like
                        Last Post jgualdronc  
                        Started by Option Whisperer, Today, 09:55 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post Option Whisperer  
                        Started by halgo_boulder, 04-20-2024, 08:44 AM
                        2 responses
                        22 views
                        0 likes
                        Last Post halgo_boulder  
                        Started by mishhh, 05-25-2010, 08:54 AM
                        19 responses
                        6,189 views
                        0 likes
                        Last Post rene69851  
                        Working...
                        X