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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      167 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      88 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      128 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      208 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      185 views
      0 likes
      Last Post CarlTrading  
      Working...
      X