Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PlotBrush color selection

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

    PlotBrush color selection

    Hi,
    I'm developing an indicator. It plots trend variation line. I initially used Addplot() with transparent brush. Later on depending on bar close the brush color is set to lime and red. But the color Lime and Red I'm not able to select on Properties page while loading the indicator. Color got hard coded in the indicator. I can only change "transparent" to some other color but that too does not change the final indicator color. It remains Lime and Red only.
    How can I make PlotBrush color selection available on indicator's properties page? Following is the code:-
    if (State == State.SetDefaults)
    {
    '
    '
    AddPlot(new Stroke(Brushes.Transparent, DashStyleHelper.Solid, 2, 100), PlotStyle.Line, "Trend");
    '
    '
    }

    protected override void OnBarUpdate()
    {
    .
    .
    .
    if(Close[0]<Trend[0]){
    PlotBrushes[0][0] = Brushes.Red;
    }
    else PlotBrushes[0][0] = Brushes.Lime;
    '
    '
    '}

    #2
    Hello vkrmvv,

    You could make user inputs for those brushes and that would appear on the properties page. The easiest way to make brush user inputs is to generate a temporary indicator. In the NinjaScript editor right click indicators and choose new indicator. In the popup that appears select the user input page and create the two brush inputs. Finish the wizard and view the code, the properties will be at the bottom and there will be defaults set in State.SetDefaults.



    After generating the properties you could replace the Brushes.Red with the first user input brush property and the same with the second user input brush property and Brushes.Lime.


    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    581 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    338 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X