Login Page - Create Account

Support Board


Date/Time: Sat, 01 Feb 2025 17:46:28 +0000



[Programming Help] - Need help with ACSIL logic

View Count: 1083

[2019-07-20 16:46:15]
User929084 - Posts: 60
Hi. I'm starting to learn ACSIL. I started with Bid Ask Difference study and added ability to choose between up/down vol, bid/ask vol and uptick/down tick. But I run into a problem. Before all the bars were displayed in line as positive. And that's what I want, because later I want to add moving avg to it. But now the bars are displayed as positive and negative ( Delta Difference in pick ).

I searched and tried many things, but can't seem to achieve what I want. I even declared them as "unsigned int" to make numbers positive, but doesn't work either.

Can someone please help with that. And explanation would be great too so I can understand how it works

Thank you.
imagebid_ask_dif.png / V - Attached On 2019-07-20 16:45:14 UTC - Size: 5.82 KB - 223 views
attachmentBidAskDifference.cpp - Attached On 2019-07-20 16:45:48 UTC - Size: 1.31 KB - 407 views
attachmentDeltaDifference.cpp - Attached On 2019-07-20 16:45:59 UTC - Size: 1.81 KB - 408 views
[2019-07-20 18:47:03]
User907968 - Posts: 825
The number you have declared as "unsigned int" are simply used to identify the base data array source, they have no effect on the actual data.

In the else block as it is now, you are performing the same calculation in both cases (Up - Down), swap the second block as shown below.


if (sc.BaseDataIn[Up][sc.Index] > sc.BaseDataIn[Down][sc.Index])
{
sc.Subgraph[0][sc.Index] = (sc.BaseDataIn[Up][sc.Index] - sc.BaseDataIn[Down][sc.Index]);
sc.Subgraph[0].DataColor[sc.Index] = sc.Subgraph[0].PrimaryColor;
}
else
{
sc.Subgraph[0][sc.Index] = (sc.BaseDataIn[Down][sc.Index] - sc.BaseDataIn[Up][sc.Index]);
sc.Subgraph[0].DataColor[sc.Index] = sc.Subgraph[0].SecondaryColor;
}

[2019-07-20 19:33:55]
User929084 - Posts: 60
Wow. That works. And that's how it actually is in the original study. So simple, yet I spent hours going over all kinds of studies looking for reference and comparing them on how to fix it.

Thank you very much.

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

Login

Login Page - Create Account