Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

To color only two bars, bull bar and a follow thru bar.

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

    To color only two bars, bull bar and a follow thru bar.

    I have to add a new line in the code? For the right condition.
    Attached Files

    #2
    Hello trdninstyle,

    Thank you for your reply.

    You'd need to use BarBrushes[barsAgo]:

    Code:
    if(Close[0] >= Open[0] && Close[1] >= Open[1])
    {
    BarBrushes[0] = PaintColor;
    BarBrushes[1] = PaintColor;
    }
    else
    {
    BarBrushes[0] = null;
    }
    Where PaintColor is a variable holding a brush we want to use to paint the bars.

    Please let us know if we may be of further assistance to you.​

    Comment


      #3
      Thank you, Kate, for that! You are the most awesome!! And that comes with two exclamation points. I'll go try that now.

      Comment


        #4
        Hi Kate,

        It seems to be saying that PaintColor; is not in the current content? I also took a snapshot of the upper part in case you can derive something from that. Other than that, it looks pretty straight forward.
        Attached Files

        Comment


          #5
          Hello trdninstyle,

          Thank you for your reply.

          As I mentioned, PaintColor is just an example variable, which should be replaced either with your own variable containing a brush or just assign a brush color directly there, like:

          BarBrushes[0] = Brushes.Orange;

          Please let us know if we may be of further assistance to you.

          Comment


            #6
            Hello Kate,

            I replaced 'PaintColor' with my own, 'Brushes.Orange; (I was later going to change it to orange). Since I have on line 54 ;BorderBrush = Brushes.SeaGreen; is that my variable? The BorderBrush?

            Because most of the consecutive (2 in a row) bull bars paint orange but the rest are painting sea green.
            Attached Files

            Comment


              #7
              What I did was, removed the line 54 all together which is the BorderBrush = Brushes.SeaGreen; compiled it. Now it's painting my own variable orange. But not perfectly, some are painting more than 2 in a row, some just one and some the 2 in a row.



              Attached Files

              Comment


                #8
                Hello trdninstyle,

                Thank you for your reply.

                If you want to restrict it to painting just the first 2 in a row before a normally painted bar, try this:

                Code:
                if(CurrentBar < 2)
                return;
                
                if(Close[0] >= Open[0] && Close[1] >= Open[1] && BarBrushes[2] != Brushes.Orange)
                {
                BarBrushes[0] = Brushes.Orange;
                BarBrushes[1] = Brushes.Orange;
                }
                else
                {
                BarBrushes[0] = null;
                }
                Please let us know if we may be of further assistance to you.​

                Comment


                  #9
                  I added the && BarBrushes[2] != Brushes.Orange) it gets it closer; it's not painting as many in a row now which is a good thing.

                  Its painting the first bull bar but not the 2nd? Now it's just some tiny little thing thats missing? Very grateful.
                  Attached Files

                  Comment


                    #10
                    Hello trdninstyle,

                    Thank you for your reply.

                    Could you please provide a code sample of what you have in your script for this right now? I'm not seeing the same on my end so something is likely incorrect.

                    Thanks in advance; I look forward to assisting you further.

                    Comment


                      #11
                      Below the BarBrushes[0]= null; I still have BarBrush = BorderBrush; Not sure if that still should be there? Or if it is supposed to be there? If not, could be messing things up.

                      I didnt see your last reply, sorry. For a code sample what does that involved? I can copy/past my entire code that I have now.
                      Last edited by trdninstyle; 09-16-2022, 01:29 PM.

                      Comment


                        #12
                        Here are two screenshots of the entire code as I have it.
                        Attached Files

                        Comment


                          #13
                          Hello trdinstyle,

                          Thank you for your reply.

                          Try removing the section at the bottom where you have BarBrushes[0] = BorderBrush as this is resetting the second bar's color to the border color.

                          Please let us know if we may be of further assistance to you.

                          Comment


                            #14
                            Yes, that worked, Kate.

                            A breakout bar would be a close above previous bar's, I was trying to write that in regard to the current bar like this for example. if(Close[0] >= Open[0] && Close[0] >= High[1]

                            So, the current bars close is above previous last couple of bars. Thats what I'm trying to display, taking what I have now & improving on it.
                            Attached Files

                            Comment


                              #15
                              BorderBrush is no longer there but I would like to make coloring of my BullBar and Follow Thru bar optional for whatever color without having to go back into the code. Would that be in the part that says, do not change or remove? Or just in another section of the code?
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

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