Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Initializing A New Brush and retrieving PlotBrush Color

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

    Initializing A New Brush and retrieving PlotBrush Color

    i am trying to get a plot from PlotBrushes

    Draw.Text(this,"T1","T1",5,dATRClose + tempATR*DT1Mult,Brushes.Red);

    I Tried

    Draw.Text(this,"T1","T1",5,dATRClose + tempATR*DT1Mult,PlotBrushes[3][0]);

    I did not get an error but It won't color.

    What I am trying to do is create a brush and get the color from PlotBrushes
    ///// this is where I am confused
    Brush tempBrush = new Brush();

    tempBrush = PlotBrushes[3][0];

    #2
    Hello,

    Thank you for the question.

    PlotBrushes would not return a brush if one has not been set yet using PlotBrushes.

    Have you at some point set a Brush for the plot in question using:
    Code:
    PlotBrushes[3][0] = someValue;
    If not, this is an optionally used collection meaning it contains nothing unless you set it and then the platform would use what you set rather than the plots defined brush for that bar.

    You would likely need to instead include the logic that sets the plot in the first place where you are trying to do this action or expose a plot from the indicator which signals when to change colors.


    I look forward to being of further assistance.

    Comment


      #3
      Retrieving Plot Brush Information

      AddPlot(new Stroke(Brushes.Gold, 2), PlotStyle.Hash, "Target1"); //5
      AddPlot(new Stroke(Brushes.Red, 2), PlotStyle.Hash, "Target2"); //6

      These were the original plots that were initialize. What I want to do is extract Brushes.Red so I can use it in my textbox.

      I thought I could create a new brush
      then

      brushname = PlotBrushes[1][0];

      Comment


        #4
        Hello,

        Thank you for clarifying.

        To use the same color as a plot, you can get what the plot was initially set to using:

        Code:
        Plots[0].Brush
        In your case if you have two total plots and the second is red, it would be:
        Code:
        Draw.Text(this,"T1","T1",5,dATRClose + tempATR*DT1Mult,[B]Plots[1].Brush[/B]);
        I look forward to being of further assistance.

        Comment


          #5
          Thanks

          I worked like a charm.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          599 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          344 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
          558 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          557 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X