Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

background color

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

    background color

    hi,

    i coded myIndicator.

    there are the plot and four DrawHorizontalLines. everytime the plot enter one of the four zones there should be a different backgroundcolor within the indicator extra panel.

    when i code this with a value then it works exact:

    code:
    double value5 = myIndicator(Period)[0];
    ( if (value5 >= 3.5)
    {
    BackColor = Color.White;
    }

    else if(value5 >= 1.56)
    {
    BackColor = Color.Blue;
    }
    else if(value5 >= 1.29)
    {
    BackColor = Color.Green;
    }

    else if(value5 < 1.29)
    {
    BackColor = Color.Yellow;
    }
    BUT when i code this with calculation instead with a value it works not exact (color changes too late, color change but not in zone ;for example):

    something from the code:
    protected override void OnBarUpdate()

    double value5 = myIndicator(Period)[0];

    double high = value3 + (value4 * 3);
    double medium = value3 + (value4 * 2);
    double low = value3 + (value4 * 0.5 );
    double verylow = value3 - (value4 * 2);

    ( if (value5 >= high)
    {
    BackColor = Color.White;
    }

    else if(value5 >= medium)
    {
    BackColor = Color.Blue;
    }
    else if(value5 >= low)
    {
    BackColor = Color.Green;
    }

    else if(value5 < verylow)
    {
    BackColor = Color.Yellow;
    }

    Thank you for help.

    #2
    Hello nt_dd,

    One thing to check here is the types are all doubles for all your value* variables. If you're mixing integer and doubles, you might not get calculations as you expect. Then, start simplifying and printing all values here so you can verify everything is what you expect.

    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    581 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    337 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X