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 Mindset, 04-21-2026, 06:46 AM
          0 responses
          44 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          56 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          35 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          95 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          57 views
          0 likes
          Last Post PaulMohn  
          Working...
          X