Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BackColor paints too much

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

    BackColor paints too much

    1) Chart is moved slightly to the left to make some drawing space.
    2) BackColor is used to color bars according to some rule.
    3) The rule kicks in on the last (current) bar.
    4) The complete area to the right of the bar is colored as well.

    The free area to the right of the chart flashes madly if the rule for coloring is continuously activated and deactivated. I hope this isn't by design and that you can change it to only color the background of the bar.

    I've attached a small snippet showing the problem, BackColor being set to dark gray.
    Attached Files

    #2
    I've tried to reproduce this but was unsuccessful. What is the rule you're using?
    Vince B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Vincent View Post
      I've tried to reproduce this but was unsuccessful. What is the rule you're using?
      I'm sorry that I was unclear. It isn't the rule that is the problem.

      I've attached another image that is larger and hopefully clearer. It sets BackColor for "outside bars". The problem is that BackColor paints the background of the last bar and the rest of the free area to the right of the bar.

      If you then have a rule that evaluates to "true", "false" etc several times intrabar, that switching of color of the large free area is visually disturbing. It would be much better if only the background color of the bar in question was painted.
      Attached Files

      Comment


        #4
        Thanks for your suggestion. We'll add it to the list of future considerations.

        Comment


          #5
          BackColor only paints realtime

          NT 7 user

          Recently I updated an oscillator so that the background color would change to blue if it crossed the zero line and red if it passed below. This is the code:

          if (colorbackground) //DH 08/15/2017
          {
          if (SignalLine[0] > zeroline)
          BackColor = Color.FromArgb(opacity,upColor);
          }

          {
          if (SignalLine[0] < zeroline)
          BackColor = Color.FromArgb(opacity,downColor);
          }

          The indicator compiles fine and works great with the exception that it only works real time. While the market is moving then the background colors on a bar by bar basis starting at the currently bar. Gradually this updates as more bars are added but none of the previous bars cause the background to change. Then if there is any need for the indicators on the chart to be changed then when that change is applied the background is wiped clear and it starts again.

          I know that it must be something that I am doing wrong because this functionality is in many indicators but as a newbie programmer I would be most grateful if you could point me in the right direction.

          Thanks

          David

          Comment


            #6
            Hello David,

            What is it you'd like the indicator to do? Have a different background for each bar, similar to the picture I have posted?

            I look forward to your reply.
            Attached Files
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by sidlercom80, 10-28-2023, 08:49 AM
            168 responses
            2,262 views
            0 likes
            Last Post sidlercom80  
            Started by Barry Milan, Yesterday, 10:35 PM
            3 responses
            10 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by WeyldFalcon, 12-10-2020, 06:48 PM
            14 responses
            1,429 views
            0 likes
            Last Post Handclap0241  
            Started by DJ888, 04-16-2024, 06:09 PM
            2 responses
            9 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            41 views
            0 likes
            Last Post jeronymite  
            Working...
            X