Login Page - Create Account

Support Board

Date/Time: Sun, 29 Mar 2020 20:47:53 +0000

[User Discussion] - Coloring Background based on consecutive bars

[2019-08-09 23:37:17]
Chris_uk - Posts: 66 | Ending Date: 2020-04-07
I am wondering if there is a way to shade the background of consecutive bars, starting at 2 bars and continuing until there is a bar in the opposite direction. A shaded box that encapsulates the bars would be ideal, rather than the entire background.

I have posted a screenshot of what I am trying to achieve. The example has been manually drawn and does not highlight every instance of consecutive bars.

If any user could help me with this it would be very much appreciated.


Many Thanks!
Date Time Of Last Edit: 2019-08-09 23:42:55
[2019-08-10 07:39:52]
Bill Black - Posts: 6 | Ending Date: 2020-02-29 [Expired]
The closest I could get is two studies -> Color bar based on Alert Condition. Short: And(C<O,C[-1]<O[-1]) Long: And(C<O,C[-1]<O[-1])
Select the draw style Fill Rectangle Down. It doesn't draw the box like you had it but it's not top-to-bottom either.

ps. And make sure to evaluate on close.
Date Time Of Last Edit: 2019-08-10 07:41:16
[2019-08-10 07:53:32]
Ackin - Posts: 666 | Ending Date: 2020-09-04

you can download study for free from our CZ/SK forum
(just Study in dll file, not code).

Study: Coloring consecutive bars

More information:
imageColoring consecutive bars.png / V - Attached On 2019-08-10 07:53:14 UTC - Size: 26 KB - 63 views
[2019-08-10 11:56:39]
Chris_uk - Posts: 66 | Ending Date: 2020-04-07
Hello User347139 and Ackin,

Thanks for this, very kind of you to help.

Ackin, I have sent a registration request from your forum page.

Many Thanks!
[2019-08-10 12:37:04]
Chris_uk - Posts: 66 | Ending Date: 2020-04-07
Hi User347139,

The formulas above seem to be the same for long and short.

Is it possible for the coloring to start with the first bar in the series instead of the second?


Any further help appreciated!

Many Thanks
[2019-08-10 19:58:29]
Bill Black - Posts: 6 | Ending Date: 2020-02-29 [Expired]
My mistake. Short: And(C<O,C[-1]<O[-1]) Long: And(C>O,C[-1]>O[-1])

I'm not sure how you would capture the first bar. Your problem is that if you attempted to color the first bar after a change from short to long or long to short, it would color a bar even if it weren't part of a trend. If you used an OR operator to include reversals, you'd essentially have every bar colored. I don't believe that Sierra Chart can evaluate a subsequent candle from a current candle (as we can't generally see into the future) but if someone has a custom dll or study that can do this, awesome.
[2019-08-10 20:40:14]
Chris_uk - Posts: 66 | Ending Date: 2020-04-07
Many thanks for your help and the detailed reply Bill. The dll that Ackin posted about above solves the problem.

Date Time Of Last Edit: 2019-08-10 20:42:05
[2019-08-10 23:09:22]
Bill Black - Posts: 6 | Ending Date: 2020-02-29 [Expired]
You are very welcome. Glad you found a solution.

Happy hunting.


To post a message in this thread, you need to login with your Sierra Chart account:


Login Page - Create Account