Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to avoid changing the color of the candle until the bar is closed?

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

    How to avoid changing the color of the candle until the bar is closed?

    I have an indicator that depending on some parameters I paint the candle one way or antoher, what I want is to paint this candle when the bar closes. I'm using `onBarClose()` and the configurator is `Calculate = Calculate.OnBarClose;`. what I want is when a new candle is generated paint it using for instance Brushes.Pink, and when it closes do the logic I already have to paint it in the correct color.
    So if I'm on a char of 1 min, in the 0:59:00 what is going to happen even if the price is going up/down the candle color would be Brushes.Pink, and once it is 0:00:00 (a new bar is added to the chart) it is not as the real color (previously calculated by algo)

    How can I do it?

    #2
    Hello cmtjoancolmenero,

    Thank you for your post.

    Using Calculate.OnBarClose would mean the logic would only be executed once the bar has closed.

    "what I want is when a new candle is generated paint it using for instance Brushes.Pink, and when it closes do the logic I already have to paint it in the correct color."

    If you want to change the color of the currently forming bar, you could need to use Calculate.OnPriceChange or Calculate.OnEachTick. With either of these Calculate settings, Close[0] would be the currently forming bar. To change the color of the previously closed bar, you can access it by using Close[1]. [1] will be the just closed bar in this mode.



    Please let us know if you have any further questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    636 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    568 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    571 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X