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

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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        43 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  
        Started by ghoul, Today, 06:02 PM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        46 views
        0 likes
        Last Post jeronymite  
        Working...
        X