Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BackColor paints too much

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

  • NinjaTrader_AlanP
    replied
    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

    Leave a comment:


  • DavidHunter
    replied
    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

    Leave a comment:


  • NinjaTrader_Dierk
    replied
    Thanks for your suggestion. We'll add it to the list of future considerations.

    Leave a comment:


  • tobbe
    replied
    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

    Leave a comment:


  • NinjaTrader_VinceB
    replied
    I've tried to reproduce this but was unsuccessful. What is the rule you're using?

    Leave a comment:


  • tobbe
    started a topic BackColor paints too much

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by pmachiraju, 11-01-2023, 04:46 AM
8 responses
148 views
0 likes
Last Post rehmans
by rehmans
 
Started by mattbsea, Today, 05:44 PM
0 responses
5 views
0 likes
Last Post mattbsea  
Started by RideMe, 04-07-2024, 04:54 PM
6 responses
33 views
0 likes
Last Post RideMe
by RideMe
 
Started by tkaboris, Today, 05:13 PM
0 responses
5 views
0 likes
Last Post tkaboris  
Started by GussJ, 03-04-2020, 03:11 PM
16 responses
3,282 views
0 likes
Last Post Leafcutter  
Working...
X