Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Log Error with JurbolBBmacd indicator

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

    Log Error with JurbolBBmacd indicator

    I've installed the JurbolBBmacd indicator found in the NT8 indicators.

    When I launch NT8 and have a chart with this indicator loaded I get an error in the Log file.

    Error on calling 'OnStateChange' method: Added Plots or Lines must have a unique name

    Any idea what is causing this?

    regards,
    taddypole...

    #2
    I got it also.

    2015-11-05 21:43:12:762 ERROR: Indicator 'JurbolBBmacd': Error on calling 'OnStateChange' method: Added Plots or Lines must have a unique name

    They sure look unique. Connecting to Playback-MR shows no issues.


    Code:
    			else if (State == State.Configure)
    			{
    				AddPlot(new Stroke(Brushes.Orange, 4), PlotStyle.Dot, "Macd");
    				AddPlot(new Stroke(Brushes.Black, 1), PlotStyle.Line, "Avg");
    				AddPlot(new Stroke(Brushes.LimeGreen, 2), PlotStyle.Line, "BUpper");
    				AddPlot(new Stroke(Brushes.Red, 2), PlotStyle.Line, "BLower");
    				
    				AddLine(Brushes.DarkGray, 0, "Zero line");
    			}

    Now my whole NT is screwed up. I tried to edit the indicator and now I get these uncorrectable errors.
    Attached Files

    Comment


      #3
      I restarted and that funky error went away.

      Anyways - I kept modifying the code...

      Removing Brushes, going to very unique names, and it was still there.

      Finally Moved it to State.SetDefaults and it stopped displaying the error message.


      Code:
      	
      		protected override void OnStateChange()
      		{
      			if (State == State.SetDefaults)
      			{
      				Description					= @"Jurbol BBMacd. Combination of Bollinger Bands and Macd. Programmed for NT 8.";
      				Name						= "JurbolBBmacd";
      				Calculate					= Calculate.OnEachTick;
      				IsOverlay					= false;
      				DisplayInDataBox			= false;
      				DrawOnPricePanel			= false;
      				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;
      
      							AddPlot(Brushes.Orange, "Macd11");
      				AddPlot(Brushes.Black, "Avg11");
      				AddPlot(Brushes.LimeGreen, "BUpper11");
      				AddPlot(Brushes.Red, "BLower11");
      				
      				AddLine(Brushes.DarkGray, 0, "Zero line11");	
      			}
      			else if (State == State.Configure)
      			{
      ;
      			}
      		}

      Comment


        #4
        Moving it back to State.Configure and adding a Print statement shows it is called only once.

        Code:
        			else if (State == State.Configure)
        			{
        				Print ("Jurbo State.Configure");
        ;AddPlot(Brushes.Orange, "Macd11");
        				AddPlot(Brushes.Black, "Avg11");
        				AddPlot(Brushes.LimeGreen, "BUpper11");
        				AddPlot(Brushes.Red, "BLower11");
        				
        				AddLine(Brushes.DarkGray, 0, "Zero line11");	
        			}
        Output:

        Jurbo State.Configure
        Indicator 'JurbolBBmacd': Error on calling 'OnStateChange' method: Added Plots or Lines must have a unique name
        I suspect State.Configure isn't too swift and doesn't realize it's already out there on a chart.

        Comment


          #5
          Strange Parameters in JurbolBBmacd indicator

          Also in the JurbolBBmacd indicator are some strange parameters listed as shown in the attachment. Don't know where these are coming from.

          Never seen this anomaly before.

          regards,
          taddypole...
          Attached Files

          Comment


            #6
            Hello,

            I just wanted to confirm the message 'Error on calling 'OnStateChange' method: Added Plots or Lines must have a unique name' would come from putting the AddPlots in Configure rather than SetDefaults. Although they are unique the message is shown when used in that state. The correct state per the help guide is SetDefaults.

            For the image with the strange paramaters,

            these are the properties being shown in the label, the colors specifically.

            If you wanted to remove the labels and just have the name, the following code could be added into the indicators class.

            Code:
            public override string DisplayName
            {
            	get { return Name; }
            }


            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello,

              The correct state per the help guide is SetDefaults.



              I look forward to being of further assistance.
              Hmmm




              Warning: This method should ONLY be called within the OnStateChange() method during State.SetDefaults or State.Configure

              Comment


                #8
                Jesse,

                How do I selectively add a ZERO line to a panel when certain options are selected? Is there a way to add a Transparent ZERO line and then change the color in the CONFIG section? In the SetDefaults, the user hasn't made up there mind yet as to the type of chart they want to see, so setting a zero line there is too early in the State sequence for AddLine().

                Comment


                  #9
                  Okay,

                  Answered my own question. This worked:

                  1) Set transparent Line in SetDefaults
                  2) In Configuration, activate the line:
                  Lines[0].Brush=m_Black.Brush;

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Kaledus, Today, 01:29 PM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by frankthearm, Yesterday, 09:08 AM
                  13 responses
                  45 views
                  0 likes
                  Last Post frankthearm  
                  Started by PaulMohn, Today, 12:36 PM
                  2 responses
                  16 views
                  0 likes
                  Last Post PaulMohn  
                  Started by Conceptzx, 10-11-2022, 06:38 AM
                  2 responses
                  55 views
                  0 likes
                  Last Post PhillT
                  by PhillT
                   
                  Started by yertle, Yesterday, 08:38 AM
                  8 responses
                  37 views
                  0 likes
                  Last Post ryjoga
                  by ryjoga
                   
                  Working...
                  X