Login Page - Create Account

Support Board

Date/Time: Sat, 24 Aug 2019 12:31:05 +0000

Need Help with ACSIL logic and color bar.

Support Request:
[2019-08-11 14:53:27]
User929084 - Posts: 35
Hi. I'm learning ACSIL and adding one thing at a time so I can understand how it works. So I modified Bid Ask Difference study from user contributed studies and added MA to it, and everything works fine up until now (DeltaDifferencewithBarColor). But now I want to add ability to color bars and add logic when to color the bars, and I don't know how to do it (DeltaDifferencewithBarColor.1). I looked at Color Bar Based On Above/Below Study and other user contributed studies, but can't seem to figure it out.

I want to get a signal when bid or ask bar closes above the MA of the study. I accomplished that with color bar based on alert condition =AND(C>O,ID1.SG1>ID2.SG1) where ID1 is Bid Ask Dif. and ID2 is the MA.

So in the ACSIL I think this is the same as above:
if (sc.BaseDataIn[SC_LAST][sc.Index] > sc.BaseDataIn[SC_OPEN][sc.Index] && sc.BaseDataIn[Up][sc.Index] > sc.BaseDataIn[Volume_MA][sc.Index]);

And I don't know how to add color bar function. Could someone please help.

I attached both files.

Thank you.
attachmentDeltaDifferencewithBarColor.cpp - Attached On 2019-08-11 14:52:39 UTC - Size: 2.86 KB - 9 views
attachmentDeltaDifferencewithBarColor.1.cpp - Attached On 2019-08-11 14:52:46 UTC - Size: 3.4 KB - 8 views
[2019-08-11 17:27:52]
User907968 - Posts: 98
I don't think that you can draw a subgraph in one region and then directly color a graph in a separate region, assuming this is what you wanted to do?

I attach some quickly modified code with two examples of what you could do.

1- color the background behind Delta Difference bars
2- color the delta difference bars themselves

Hopefully you can see the differences in the code and it is helpful.
attachmentDeltaDifferencewithBarColor.1.cpp - Attached On 2019-08-11 17:27:13 UTC - Size: 9.58 KB - 8 views
[2019-08-11 19:49:46]
User929084 - Posts: 35
Thank you for your response. I actually want to color the bars on the main chart. And I'm aware that I need to put the study in the main price graph in order to change the bar colors.

For now I want figure out how to change the color of bars, with the logic in post #1. And then will go from there.

Any suggestions how I can do that?

And is this line even valid code:
if (sc.BaseDataIn[SC_LAST][sc.Index] > sc.BaseDataIn[SC_OPEN][sc.Index] && sc.BaseDataIn[Up][sc.Index] > sc.BaseDataIn[Volume_MA][sc.Index]);

If so how can I add ability to pain the bars based on that logic?

Thank you.
[2019-08-11 21:23:54]
User907968 - Posts: 98
Ok, understand now, updated file attached.
Look at the third example, this does what you are asking, I also added some comments that may help.

"if (sc.BaseDataIn[SC_LAST][sc.Index] > sc.BaseDataIn[SC_OPEN][sc.Index] && sc.BaseDataIn[Up][sc.Index] > sc.BaseDataIn[Volume_MA][sc.Index]);"
This is not valid, that is why I removed it from the previous examples.

I am sure you have looked at it already, but you really can find just about all that you'll need in the ACSIL documentation.

Date Time Of Last Edit: 2019-08-11 21:24:13
attachmentDeltaDifferencewithBarColor.1.cpp - Attached On 2019-08-11 21:14:23 UTC - Size: 13.05 KB - 8 views
[2019-08-11 23:47:11]
User929084 - Posts: 35
Thank you very much for your help. That's exactly what I wanted to accomplish.
[2019-08-14 00:16:18]
User929084 - Posts: 35
Ok so I added some stuff and modified the study a bit. But what can I do to make the signal bars the same color as price bars instead of dominant delta bars color? I tried different approaches and can't get it done.

Study 1.5 is what I want, and 1.6 I tried to do the above.

Also I put the studies in chart region 3 and 4 as well as main price graph, just to see if everything works correctly and noticed the colored signal bar from price graph show up in the studies region 3 and 4. Not a big deal since I will only have the study in the main price graph region when I'm done testing it.

Thank you.
attachmentDeltaDifferencewithBarColor1.5.cpp - Attached On 2019-08-14 00:15:35 UTC - Size: 5.62 KB - 5 views
attachmentDeltaDifferencewithBarColor1.6.cpp - Attached On 2019-08-14 00:15:41 UTC - Size: 5.7 KB - 5 views
imageDelta_Diff.png / V - Attached On 2019-08-14 00:16:05 UTC - Size: 31.98 KB - 15 views
[2019-08-14 07:41:07]
User907968 - Posts: 98
Not entirely clear on exactly what you mean by this -

"But what can I do to make the signal bars the same color as price bars instead of dominant delta bars color?"

Assuming that you mean when drawing arrows or similar above/below, set auto-coloring to same as base graph and choose appropriate colors.
I don't know if / how you can get these colors programmatically.

Also, I modified your code slightly.
attachmentDeltaDifferencewithBarColor1.7.cpp - Attached On 2019-08-14 07:40:52 UTC - Size: 5.54 KB - 6 views
Attachment Deleted.
[2019-08-14 13:11:27]
User929084 - Posts: 35
Thank you for your help.

What I mean by

"But what can I do to make the signal bars the same color as price bars instead of dominant delta bars color?"

is that now the signal bars for the study are colored based on the dominant delta bars. So when there's more selling on delta and I get the signal, the signal bar will turn red even though the price bar itself might be up bar. And vice versa for more buying on delta. It doesn't happen that often.

But I would like the signal bar to be the same color as price bar. So when I get the signal, the signal color would be blue if the price bar is up, even though the dominant delta might be red.

Thank you.
[2019-08-14 13:52:17]
User907968 - Posts: 98
Ok, I understand now.
So the solution above should work fine.
[2019-08-14 23:02:08]
User929084 - Posts: 35
Thank you very much.
[2019-08-16 21:59:02]
User929084 - Posts: 35
So I put the indicator on ES chart ( mostly trading NQ) and I got the vertical green and red lines on the chart ( Delta diff pic). These lines are from the study and the study shows up at the bottom of the chart (Delta diff zoomed out pic).

I can just ignore those lines in subgraphs. But how can I fix the study so it doesn't even show up on the chart in the first place?

Thank you.
imageDelta_Diff.png / V - Attached On 2019-08-16 21:58:31 UTC - Size: 42.83 KB - 8 views
imageDelta_diff_zoomed_out.png / V - Attached On 2019-08-16 21:58:37 UTC - Size: 47.46 KB - 9 views
[2019-08-17 07:09:10]
User907968 - Posts: 98
Refer to my earlier example, either comment out or remove the relevant lines in the 'sc.SetDefaults' section.


    //No need to set values these if adding to main chart as only used for calculation and visibility is not required

    //Delta_Volume.Name = "Delta Volume";
    //Delta_Volume.DrawStyle = DRAWSTYLE_BAR;
    //Delta_Volume.PrimaryColor = RGB(0, 255, 0);
    //Delta_Volume.SecondaryColor = RGB(255, 0, 0);
    //Delta_Volume.SecondaryColorUsed = 1;

[2019-08-19 03:33:43]
User929084 - Posts: 35
Ok. I will just set the subgraphs to ignore then.

Thank you.
[2019-08-19 07:04:30]
User907968 - Posts: 98
Ok, if that is what, but to achieve what you asked -

"But how can I fix the study so it doesn't even show up on the chart in the first place?"

Refer this -


Simply do not set the name parameter for the relevant subgraphs.

Delta_Volume.Name = "";

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


Login Page - Create Account