Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PlotBrushes change style to dotted

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

    PlotBrushes change style to dotted

    I have an indicator where I add plots, and then with `PlotBrushes[0][0]` I can change the color, for instance, my code right now is :

    //This is how I add them in the `OnStateChange` inside of `State.SetDefaults`
    AddPlot(Brushes.OrangeRed);
    AddPlot(Brushes.OrangeRed);

    Then depending on some conditions I change the color as :

    if (foo)
    {
    PlotBrushes[0][0] = Brushes.Lime;
    PlotBrushes[1][0] = Brushes.Lime;
    }
    else if (bar)
    {
    PlotBrushes[0][0] = Brushes.Red;
    PlotBrushes[1][0] = Brushes.Red;
    }​

    The problem now I'm having is :

    First : I want the first one be solid and the second one be dotted but I don't know how can I change it, I've been reading around this forum and what I've found is to add the plot as :

    AddPlot(new Stroke(Brushes.OrangeRed, DashStyleHelper.Solid, 2), PlotStyle.Line, "Plot1");
    AddPlot(new Stroke(Brushes.OrangeRed, DashStyleHelper.Solid, 2), PlotStyle.Line, "Plot2");

    Then I can play with "Plot1" and "Plot2" so I can update just the `Brushes.OrangeRed` to my desired color, but don't find the way to do it.

    Second: I'd like to know is if, is it possible to get the plot1 position to draw an arrow just above this "Plot1" since I'm using this to draw the arrow

    Draw.ArrowUp(this, "Up " + CurrentBar, false, 0, Low[0] - 2 * TickSize, Brushes.White);

    I want to draw this ArrowUp below the Plot (I need to check but it should be the dotted one.


    #2
    Hello cmtjoancolmenero,

    PlotBrushes can only control the color of the plot, to control the style of the line you would need to use the second set of code for AddPlot that you posted and use PlotStyle.Dot.

    AddPlot(new Stroke(Brushes.OrangeRed, DashStyleHelper.Solid, 2), PlotStyle.Dot, "Plot2");

    You can find the available styles here: https://ninjatrader.com/support/help...t8/addplot.htm

    To draw an arrow above the plot you would need to replace Low[0] with your plots name instead, if you created public properties for the plots that would be Plot1[0]

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    576 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    553 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X