Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Registering a plot based on user requirement

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

    Registering a plot based on user requirement

    Hi,
    I'm registering a plot in State == State.SetDefaults as follows:

    if(displayPlot == true)
    AddPlot(Brushes.Orange, "MyPlot");

    And I also have a similar statement for setting the value:
    if (displayPlot == true)
    MyPlot[0] = value;

    where I have defined a property for MyPlot.

    This is not working as if the default value for displayPlot is true I get a plot as expected but if then override displayPlot to false in the indicator property page for the indicator I was wanting the Plot to disappear. How can I achieve this? The reason I want to do this is that the same indicator also paints the bars so I want to be able to turn off the plot.

    Thanks,
    iq

    #2
    Hello,

    Thank you for the post.

    I wanted to check, is displayPlot a private variable where you also have a public variable named DisplayPlot? If so, you would need to use the capitalized property to see user changes:

    Code:
    if(DisplayPlot == true)


    I look forward to being of further assistance.

    Comment


      #3
      Hi,
      No the property name is DisplayPlot and the private class variable name the property uses is displayPlot:

      [NinjaScriptProperty]
      [Display(Name = "Display Plot", Order = 0, GroupName = "Parameters")]
      public bool DisplayPlot
      {
      get { return displayPlot; }
      set { displayPlot = value; }
      }

      Comment


        #4
        Hello,

        Yes, this is what I was asking. You defined the public property with Capitalization:

        public bool DisplayPlot

        You would need to use the Capitalized property name and not the private variable name where ever you want to use this value in your logic.

        Please try to instead use DisplayPlot and then re test to check the result.

        Please let me now if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        576 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        553 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X