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

Hiding Plots

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

    Hiding Plots

    Hello Everyone.

    I an new to indicator development for NinjaTrader. I am presently using version 7

    I am creating what I can only describe as a compound indicator. What I am attempting to do is use code to experiment with a trading concept that I have come up with. This concept includes the use of several different indicators, some of which will have slight alterations.

    I will later use the calculations from all this indicators to plot entry and exit triggers on the chart and to highlight moments of consolidation.

    I am using BolingerBand, Keltner Channels, and the Aroon Indicators to evaluate moments of consolidation. While I technically do not need the values of these indicators to plot, to testing purposes, and future reference, I would like to see these values with respect to price action to evaluation my algorithm's determination of consolidation and the consolidation plot.

    To achieve this I created the following parameters...

    #region OnOffPlots

    [GridCategory("Plots"), Description("Turns on/off Aroon Osculator")]
    public bool onoff_Aroon_Osc
    {
    get {return onoff_aroonosc; }
    set {onoff_aroonosc = value;}
    }

    [GridCategory("Plots"), Description("Turns on/off Aroon Up/Down")]
    public bool onoff_Aroon
    {
    get {return onoff_aroon; }
    set {onoff_aroon = value;}
    }

    #endregion


    In the initialize function I have the following ....

    Add(new Plot(Color.Orchid, PlotStyle.Line, "Aroon_Osc"));
    Plots[0].Pen.Width = 2;
    if (onoff_aroonosc == false) {Plots[0].Pen.Color = Color.Transparent;};

    Add(new Plot(Color.SpringGreen, PlotStyle.Line, "Aroon_Up"));
    Plots[1].Pen.Width = 2;
    if (onoff_aroon == false) {Plots[1].Pen.Color = Color.Transparent;};

    Add(new Plot(Color.Crimson, PlotStyle.Line, "Aroon_Down"));
    Plots[2].Pen.Width = 2;
    if (onoff_aroon == false) {Plots[2].Pen.Color = Color.Transparent;};



    I can see the drop downs for each of my bool parameters. However, when I set them to false, the indicator is still visible.

    Would anyone have any other suggestions on how I could make a plot visible or invisible with a true/false parameter as a user input?

    #2
    Hello jeliner,

    Thank you for writing in.

    You'll want to place the logic of changing your plot colors to transparent in OnBarUpdate() rather than Initialize(). Additionally, ensure to have your plots revert back to their original color if your bool is set to true or it will maintain the transparent color otherwise.

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    32 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, Yesterday, 09:53 PM
    2 responses
    49 views
    0 likes
    Last Post wzgy0920  
    Started by Kensonprib, 04-28-2021, 10:11 AM
    5 responses
    191 views
    0 likes
    Last Post Hasadafa  
    Started by GussJ, 03-04-2020, 03:11 PM
    11 responses
    3,230 views
    0 likes
    Last Post xiinteractive  
    Started by andrewtrades, Today, 04:57 PM
    1 response
    15 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X