Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change Plot Style in OnBarUpdate?

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

    Change Plot Style in OnBarUpdate?

    I'm guessing that it is not possible to change the plot syle outside of State.SetDefaults?
    I know I can change the plot brushes with PlotBrushes[X][X] = Brushes.XXXX;
    It would be awesome if I could do the same with the plot style.

    #2
    Hello AssIsChubby,

    Thank you for your post.

    It's possible to change the Plot Style in OnBarUpdate:

    Code:
    public class OBUPlotStyleChangeTest : Indicator
    {
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "OBUPlotStyleChangeTest";
    Calculate = Calculate.OnBarClose;
    IsOverlay = true;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    AddPlot(Brushes.Orange, "TestPlot");
    }
    else if (State == State.Configure)
    {
    }
    }
    
    protected override void OnBarUpdate()
    {
    Plots[0].PlotStyle = PlotStyle.Dot;
    
    Value[0] = Close[0];
    }
    
    #region Properties
    
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> TestPlot
    {
    get { return Values[0]; }
    }
    #endregion
    
    }
    That example will change the plot style to Dot instead of a line.

    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Sweet! Thank you Kate!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      45 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      31 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X