Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

HidePlot not functioning

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

    HidePlot not functioning

    I am trying to hide a plot as a user Input. The following compiles but doesn't work.

    Code:
      protected override void Initialize()
    {
    
    if (hidePlots)
    				
    {
    Add(new Plot(Color.Transparent, PlotStyle.Line, "AboveZero"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "BelowZero"));
    Add(new Line(Color.FromKnownColor(KnownColor.ActiveCaptionText), 0, "ZLine"));
    
    }
    else
    {
    Add(new Plot(Color.FromKnownColor(KnownColor.YellowGreen), PlotStyle.Line, "AboveZero"));
    Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "BelowZero"));
    Add(new Line(Color.FromKnownColor(KnownColor.ActiveCaptionText), 0, "ZLine"));
    }
    
    }

    #2
    Mindset,

    You should not place logic in Initialize(). Instead you can try it in OnBarUpdate().

    Code:
    if (hidePlots)
         Plots[0].Pen = new Pen(Color.Transparent);
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Many thanks Josh.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by sidlercom80, Today, 02:40 AM
      0 responses
      12 views
      0 likes
      Last Post sidlercom80  
      Started by b16_aln, Today, 01:52 AM
      0 responses
      11 views
      0 likes
      Last Post b16_aln
      by b16_aln
       
      Started by junkone, Yesterday, 08:55 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by adaeiqendqw, 01-16-2021, 02:56 AM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by [email protected], Yesterday, 06:10 PM
      5 responses
      17 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Working...
      X