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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        160 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        307 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        244 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        348 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        178 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X