Login Page - Create Account

Support Board


Date/Time: Thu, 06 Mar 2025 13:10:20 +0000



Question re Color Bars

View Count: 444

[2022-01-30 18:06:34]
User39772 - Posts: 311
Hello,

I understood that to change the candle color in a chart, depending on an study, the following steps are necessary:

//Studygraph config
Subgraph_Indicator.Name = "Indicator";
Subgraph_Indicator.DrawStyle = DRAWSTYLE_COLOR_BAR;
Subgraph_Indicator.LineWidth = 5;
Subgraph_Indicator.SecondaryColorUsed = true;
Subgraph_Indicator.AutoColoring = true;
Subgraph_Indicator.PrimaryColor = RGB(124, 252, 0);
Subgraph_Indicator.SecondaryColor = RGB(242, 20, 20);
Subgraph_Indicator.DrawZeros = false;

if (condition)

//Change candle color, if condition is true
Subgraph_Indicator[sc.Index] = Subgraph_Indicator.PrimaryColor;

else

//Do not change candle color, if condition is not true
//Because Subbgraph_Indicator.DrawZeros = false, color remains unchanged
Subgraph_Indicator[sc.Index] = 0;


The problem I see, is some unexpected behavior.
On one hand the color changes as expected, but on the other hand I set
the values of the indicator array to 0 at the current index, so that other
code that makes use of this values, does not work properly.

Can you tell me, if my understanding is wrong ?
Date Time Of Last Edit: 2022-01-31 09:05:55
[2022-01-31 03:41:32]
1+1=10 - Posts: 270
“Subgraph_Indicator[sc.Index]” is for setting the value the subgraph. To set the color you have to use Subgraph_Indicator.DataColor[sc.Index]

See further instructions here:
ACSIL Programming Concepts: Custom Subgraph Coloring

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

Login

Login Page - Create Account