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

    #16
    Hello trdninstyle,

    Thank you for your reply.

    To clarify, do you mean you want to color them only if a user opts to color them, or you want the user to be able to pick the color they get painted?

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

    Comment


      #17
      "or you want the user to be able to pick the color they get painted?" Yes, for the user to pick the color. Thank u !!

      Comment


        #18
        I really got this now, before there were too many bars being colored. I made it to have a breakout bar, (Close above prev. bars High)

        (And usually, it's also above more than a couple of bars, and catches reversal bars)

        and the follow thru bar's close to be above its prev. bars High, so it's not a doji or weaker bar. It has to be a strong breakout and strong follow thru, then expect some kind of pullback before proceeding.

        Then I'll at least be looking at price in tuned to the swing structure. I hope. lol

        Yes, I would like to have the user be able to change the colors as they desire.
        Attached Files
        Last edited by trdninstyle; 09-17-2022, 07:24 AM.

        Comment


          #19
          Hello Kate, how do I set it up for the user to have the option to change the colors? Please.

          Also, I want to have current bars close to be one tick above the High of the prior bar to avoid the two bars from painting if there's a doji at the same level of prior bars high?
          (When the Close & High (1) are the same) Would I say == ? f (< Less) (> Greater) (== Equal?)

          This is how it is currently... if(Close[0] >= High[1] && Close[1] >= High[2].

          I tried, if(Close[0] >= High+1Tick[1] but I knew that wasn't going to cut it.
          Is there a way to have it say, one tick above the High?
          Attached Files
          Last edited by trdninstyle; 09-19-2022, 06:16 PM.

          Comment


            #20
            Hello trdninstyle,

            Thank you for your replies.

            You would need to add a bool user input to the script in order to have the coloration be optional. You could set this to either true or false initially, and then check whether the bool is true in your conditions to change the colors.

            This page of our help guide goes over adding user inputs:



            You should not change or remove anything in the automatically generated section of code that says not to change or remove it.

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

            Comment


              #21
              Okay, thanks for that. I'll pull up some examples in the code from other indicators that allow the user to change color and see what that looks like.


              else (??) ..Do not paint in this case

              if(Close[0] == High[1] && Close[1] >= High[2]

              How would I tell it not to paint if the close of current bar is same as the High of previous bar?
              Like in the case of a breakout bars close & high are the same (Shaved Top) and follow thru bars open close same, doji.

              Comment


                #22
                Hello trdninstyle,

                Thank you for your reply.

                If you don't want the bar painted if certain conditions are true (even if otherwise the conditions to paint are true), you can make an if statement after the one that paints the bars, put your additional conditions there, and if those are true, set the BarBrush to null.


                Code:
                // conditions to paint the bars go here
                
                // if our other conditions were true, but the close is equal to the high OR the close is equal to the open
                if (Close[0] == High[0] || Close[0] == Open[0])
                {
                BarBrushes[0] = null;
                }
                Please let us know if we may be of further assistance to you.
                Last edited by NinjaTrader_Kate; 09-20-2022, 10:19 AM. Reason: Corrected typo

                Comment


                  #23
                  My question's is in the pic. I'm definitely learning, tho. Thanks to you.
                  Attached Files

                  Comment


                    #24
                    Hello trdninstyle,

                    Thanks for your reply.

                    There was a typo in my last post I've corrected now.

                    You can make the vertical lines by holding the shift + \ keys (generally located right above the enter key).

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

                    Comment


                      #25
                      Hello trdninstyle,

                      Thank you for your reply.

                      No, you would want it to look like this:

                      Code:
                      if(Close[0] >= Open[0] && Close[1] >= Open[1])
                      {
                      BarBrushes[0] = PaintColor;
                      BarBrushes[1] = PaintColor;
                      }
                      else
                      {
                      BarBrushes[0] = null;
                      }​​​
                      
                      if (Close[0] == High[0] || Close[0] == Open[0])
                      {
                      BarBrushes[0] = null;
                      }
                      Please let us know if we may be of further assistance to you.

                      Comment


                        #26
                        Sometimes after you post it doesn't show up until much later.

                        I went back and thought about it & moved it around and did come up w/ what I see now. I was just going to ask, how's this?
                        But it still painted the breakout bar before the doji?

                        Thank you for helping me.
                        Attached Files

                        Comment


                          #27
                          You're going to be proud of me. The breakout bar prior to the doji did not paint.

                          if (Close[0] == High[1] || Close[0] == Open[0])
                          {
                          BarBrushes[1] = null;
                          }
                          Attached Files

                          Comment


                            #28
                            Within the region Properties it already was set at "BorderBrush", which we removed. What I tried but didn't work, was replace the word BorderBrush with BarBrushes.

                            Would I be able to use what's mostly there but only change a few things? This is so I can have user change color of bars.
                            Attached Files
                            Last edited by trdninstyle; 09-20-2022, 05:32 PM.

                            Comment


                              #29
                              Hello trdninstyle,

                              Thank you for your reply.

                              You could rename that input to something like "TwoBarBrush" and then use that in place of the hardcoded brushes to allow a user to choose the color, but that wouldn't change the painting behavior - to control whether or not it paints would require a bool user input as I previously mentioned.

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

                              Comment


                                #30
                                To allow a user to change the color they wish rather than, say a default color. Thats what I would like to do.

                                For the Bool user input, that would be good if I add an additional feature to paint a Real Body Inside Bar Up or Down so they can elect to paint that inside body or not, but still use the BreakOut & Follow Thru feature, just choose the color for that.

                                So, replace hardcoded brushes with something like "TwoBarBrush" and that will allow them to change the color? Exactly which areas in the pic do I write in TwoBarBrush?

                                Thank you so much.
                                Attached Files

                                Comment

                                Latest Posts

                                Collapse

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