Login Page - Create Account

Support Board


Date/Time: Mon, 16 Jun 2025 08:56:38 +0000



[Programming Help] - How to Colour Price Bars base on Green and Red Cumulative Delta Volume bars ?

View Count: 1897

[2021-06-21 04:50:53]
FH87 - Posts: 43
HElPPPppPPppp.................How to Colour Price Bars, base on those Green bar and Red bar for that Cumulative Delta Volume ?



Try out search on how to do it, can't get it. Come to board for Help. Thank You

SG and ID details on attachment PNG file
Color Bar Based on Alert Condition study


http://www.sierrachart.com/image.php?Image=162425045675.png
Date Time Of Last Edit: 2021-06-21 04:52:54
imageaa20210621777882.png / V - Attached On 2021-06-21 04:47:22 UTC - Size: 87.97 KB - 352 views
[2021-06-21 12:21:48]
Sawtooth - Posts: 4227
You'll need to create a persistent value for each of the two colors so that it stays the same until the next color change.

Add the Spreadsheet Formula study
- Set the Chart Region to 1
- Use a formula like this in the Formula field:
=IF(AND(ID8.SG1[0]>ID8.SG1[-1],ID8.SG1[-1]<=ID8.SG1[-2]),1,IF(AND(ID8.SG1[0]<ID8.SG1[-1],ID8.SG1[-1]>=ID8.SG1[-2]),-1,ID6.SG1[-1]))
where ID6 is the Spreadsheet Formula study, and ID8 is the SMA Length 1 of the CDelta study.
- Set the Draw Style to Color Bar
- Set the Auto-Coloring to Based On +/-

The formula is a variation of example #9 here:
Study/Chart Alerts And Scanning: Alert Formula Examples
Date Time Of Last Edit: 2021-06-21 12:22:02
[2021-06-22 04:24:32]
FH87 - Posts: 43
Yooo Tonmgib,

thank for your help

with trial and error I manage to get it from your guide

Thanksssssssss...........Have a Nice Day !

http://www.sierrachart.com/image.php?Image=1624335905209.png
Date Time Of Last Edit: 2021-06-22 04:25:12
[2022-09-22 13:56:20]
User314524 - Posts: 14
HI
Is it possible to show exactly how you achieved to colour the price bars based on the CD
Thanks
[2025-05-18 19:55:42]
User465420 - Posts: 5
I was able to apply the formula but is there a way to only have the candle filled ONLY when there is a difference between the CD and Price? It’s unhelpful to see all the candles marked.
[2025-05-18 22:56:58]
Sawtooth - Posts: 4227
is there a way to have the candle filled ONLY when there is a difference between the CD and Price?
1. Add the Spreadsheet Formula study, with a formula like this in its Formula field:
=IF(OR(C>O,AND(O>C[-1],O=C)),1, IF(OR(C<O,AND(O<C[-1],O=C)),-1,ID6.SG1[-1]))
-where ID6 is this Spreadsheet Formula study.
This will return a 1 when the price candle is green, and a -1 when the price candle is red.
Hide this study.

2. Add another Spreadsheet Formula study, with a formula like this in its Formula field:
=IF(OR(ID8.SG4>ID8.SG1,AND(ID8.SG1>ID8.SG4[-1],ID8.SG1=ID8.SG4)),1, IF(OR(ID8.SG4<ID8.SG1,AND(ID8.SG1<ID8.SG4[-1],ID8.SG1=ID8.SG4)),-1,ID7.SG1[-1]))
-where ID8 is the CD study, and ID7 is this Spreadsheet Formula study.
This will return a 1 when the CD candle is green, and a -1 when the CD candle is red.
Hide this study.

3. Add the Color Bar Based On Alert Condition study, with a formula like this on its Alerts tab:
=ID6.SG1<>ID7.SG1
This will color the price bar whenever the CD bar is a different color than the price bar.

The above formulas to find the candle direction colors are based on this example:
Spreadsheet Example Formulas and Usage: Formula that Matches the Coloring of Up and Down Price Bars

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

Login

Login Page - Create Account