Login Page - Create Account

Support Board


Date/Time: Thu, 18 Apr 2024 12:20:56 +0000



[User Discussion] - Coloring Background based on consecutive bars

View Count: 1629

[2019-08-09 23:37:17]
Chris_uk - Posts: 89
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.

http://www.sierrachart.com/image.php?Image=1565393253811.png

Many Thanks!
Date Time Of Last Edit: 2019-08-09 23:42:55
[2019-08-10 07:39:52]
Bill Black - Posts: 6
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: 1863
Chris_uk)

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


Study: Coloring consecutive bars


contact link:
https://www.sierrachart.com/UserControlPanel.php?page=StudyStore&SCDLLName=zyp_download_free
Date Time Of Last Edit: 2020-06-24 22:31:57
[2019-08-10 11:56:39]
Chris_uk - Posts: 89
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: 89
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?


http://www.sierrachart.com/image.php?Image=1565440525166.png

Any further help appreciated!

Many Thanks
[2019-08-10 19:58:29]
Bill Black - Posts: 6
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: 89
Many thanks for your help and the detailed reply Bill. The dll that Ackin posted about above solves the problem.

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

Happy hunting.

Bill

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

Login

Login Page - Create Account