Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to refer plotbrushes by user-friendly plot name

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

    How to refer plotbrushes by user-friendly plot name

    By default, I always use:

    Code:
    PlotBrushes[0][0] = ...
    PlotBrushes[1][0] = ...
    to set the color for specific line. But is there any other way, so if i have numerous :

    Code:
    AddPlot(..., "Name1");
    AddPlot(..., "Name2");
    AddPlot(..., "Name3");
    ...etc...

    I could refer them by name ( not by numeric position) like:

    Code:
    PlotBrushes["Name1"][0] = ....
    please submit feature request for something like this, so we didnt care about position numbers

    #2
    Hello TazoTodua,

    Thanks for your post.

    You can create int variables that you can name similar to the plots names and use those variables in PlotBrushes.

    For example:

    private int firstPlot = 0;
    private int secondPlot = 1;

    AddPlot(Brushes.Orange, "FirstPlot");
    AddPlot(Brushes.Orange, "SecondPlot");

    PlotBrushes[firstPlot][0] = Brushes.CornflowerBlue;
    PlotBrushes[secondPlot][0] = Brushes.Green;

    I will submit the requested convenience feature request and will update this thread when I have further information.

    Comment


      #3
      Hello TazoTodua,

      The feature request has been assigned as SFT-4380, "Ability to use plot name in Plotbrushes[] instead of numeric index".

      Thanks for your interest in improving NinjaTrader.

      Comment


        #4
        ideally, that will be good if the Plot dataseries and PlotBrushes dataseries had a back-property (automatically implemented in IndicatorRenderBase or somewhere), like:

        AddPlot(Brushes.White, "theName");

        Values["theName"][0] = 123; //which will equal to Value[0][0] =123;
        PlotBrushes["theName"][0]= Brushes.Red; // equal to PlotBrushes[0][0] = ..

        so, there will be no need to use that "indexing" (which is quite inflexible when we add a new plot)... generally, it would be nice that indexing was replaced by named properties forever.
        so, very simple modification is needed to be done in the internals of NT - the Values & PlotBrushes property should just check if string is used as reference and use the corresponding index automatically, so users shouldnt care of that.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X