Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

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

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

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

    I added my indicator and saved it as template and opened 5 other symbols to use the template. i keep getting a error on the log
    My code shows the nams are unique,
    Code:
     protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description = @"Enter the description for your new custom Indicator here.";
                    Name = "S_Trading_System";
                    Calculate = Calculate.OnEachTick;
                    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;
                    AddPlot(Brushes.Orange, "Mean");
                }
                else if (State == State.Configure)
                {
                    AddPlot(Brushes.Aqua, "EMA 9");
                    AddPlot(Brushes.DarkGray, "EMA 22");
                }
            }

    #2
    Hello,

    Thank you for the question.

    This error would be the result of using the incorrect state for two of your plots.

    You would just need to move the AddPlot statements from Configure into SetDefaults.

    Please see the help guide for a full example: http://ninjatrader.com/support/helpG...ghtsub=addplot

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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by funk10101, Today, 09:43 PM
    0 responses
    2 views
    0 likes
    Last Post funk10101  
    Started by pkefal, 04-11-2024, 07:39 AM
    11 responses
    36 views
    0 likes
    Last Post jeronymite  
    Started by bill2023, Yesterday, 08:51 AM
    8 responses
    44 views
    0 likes
    Last Post bill2023  
    Started by yertle, Today, 08:38 AM
    6 responses
    25 views
    0 likes
    Last Post ryjoga
    by ryjoga
     
    Started by algospoke, Yesterday, 06:40 PM
    2 responses
    24 views
    0 likes
    Last Post algospoke  
    Working...
    X