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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        80 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X