Login Page - Create Account

Support Board


Date/Time: Fri, 29 Nov 2024 00:02:56 +0000



Using ascil to obtain the subgraph color from of another charts study subgraph.

View Count: 584

[2023-03-16 17:01:25]
User92573 - Posts: 530
Dear Support

Although I'm able to obtain the Data from another another Charts Subgraph (Study Subgraph) to populate the current Chart, I cannot seem to Get the Color from that other charts study subgraph.

Obviously SC own Study/Price overlay does recover not just colour but all settings from another charts study/subgraph. Please can you point me in the right direction for a solution as I've pretty much searched as far as I can but obviously missed something.

Many thanks.
[2023-03-16 17:36:11]
John - SC Support - Posts: 36350
Refer to the following:
sc.GetStudySubgraphColors()
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-03-17 10:54:03]
User92573 - Posts: 530
Hi John

Once again, thank you so much just what I needed to point me in the right direction however if you do revisit this post can I ask whether there are any studies I can reference that would provide an actual example of this applied, as I can't quite see how I obtain the COLORREF or RGB() from DrawStyle?

I realise SC doesn't provide programming help which is understandable but any additional direction would be gratefully received!

Many thanks
[2023-03-17 12:37:20]
User431178 - Posts: 544
I can't quite see how I obtain the COLORREF or RGB() from DrawStyle

It seems you might be reading the wrong information.
Follow the link and make sure to read the section titled sc.GetStudySubgraphColors() it is quite clear and does not reference the drawstyle anywhere.

int32_t GetStudySubgraphColors(int32_t ChartNumber, int32_t StudyID, int32_t StudySubgraphNumber, uint32_t& r_PrimaryColor, uint32_t& r_SecondaryColor, uint32_t& r_SecondaryColorUsed);


uint32_t PrimaryColor = 0;
uint32_t SecondaryColor = 0;
uint32_t SecondaryColorUsed = 0;
sc.GetStudySubgraphColors(1, 1, 0, PrimaryColor, SecondaryColor, SecondaryColorUsed);

[2023-03-17 14:31:10]
User92573 - Posts: 530
Sorry, yes I read on too far.


int32_t GetStudySubgraphColors(int32_t ChartNumber, int32_t StudyID, int32_t StudySubgraphNumber, uint32_t& r_PrimaryColor, uint32_t& r_SecondaryColor, uint32_t& r_SecondaryColorUsed);


So, if I then create 3 vars:


COLORREF P_COL
COLORREF S_COL;
int S_COL_USED;


Can I then obtain/utilise those values using:

SCInputRef MySubgraph_For_Study = sc.Input[0]; // my subgraph

sc.GetStudySubgraphColors(1, 1, 0, PrimaryColor, SecondaryColor, SecondaryColorUsed);

P_COL = r_PrimaryColor;
S_COL = r_SecondaryColor;
S_COL_USED = r_SecondaryColorUsed; // int value 0/1


MySubgraph_For_Study.PrimaryColor = P_COL;
MySubgraph_For_Study.SecondaryColor = S_COL;
MySubgraph_For_Study.SecondaryColorUsed = S_COL_USED;


Many thanks
[2023-03-17 14:50:18]
User431178 - Posts: 544

SCSubgraphRef MySubgraph_For_Study = sc.Subgraph[0];

uint32_t PrimaryColor = 0;
uint32_t SecondaryColor = 0;
uint32_t SecondaryColorUsed = 0;

if (sc.GetStudySubgraphColors(A, B, C, PrimaryColor, SecondaryColor, SecondaryColorUsed))
{

MySubgraph_For_Study.PrimaryColor = PrimaryColor;

MySubgraph_For_Study.SecondaryColor = SecondaryColor;

MySubgraph_For_Study.SecondaryColorUsed = SecondaryColorUsed;
}


Subtitute A, B & C in the call to GetStudySubgraphColors for the chart, study and subgraph of your choosing.
Date Time Of Last Edit: 2023-03-17 14:51:23
[2023-03-17 14:59:07]
User92573 - Posts: 530
That's really helpful, I was just programming it in the background the same way except I hadn't assigned values, only declared them.

That helped a great deal, many thanks!
[2023-03-17 15:01:12]
User92573 - Posts: 530
I did check using:

msg.Format("")
sc.AddMessageToLog(msg,1);


... and all worked as expected.
[2023-03-17 15:26:47]
User92573 - Posts: 530
Out of interest do you know if


sc.GetStudySubgraphLineStyle()
sc.GetStudySubgraphLineWidth()


... are now available?

Many thanks.
[2023-03-17 15:38:04]
User431178 - Posts: 544
I haven't used those yet myself, but they are in the header file from v2473+.
[2023-03-17 17:57:19]
User92573 - Posts: 530
Thank you. I'm using version 2455 and they are not there so I'll update and search again.
[2023-03-17 19:00:16]
User92573 - Posts: 530
Hmmm ... as you say its there in header but I can't compile it so it may be a work in progress.

I notice the documentation is incomplete for both items.

I'll put up a Support Board request and hopefully John or someone in programming will reply.
Date Time Of Last Edit: 2023-03-17 19:02:46
[2023-03-17 21:14:45]
John - SC Support - Posts: 36350
The code is in place for these two items:
sc.GetStudySubgraphLineStyle()
sc.GetStudySubgraphLineWidth()

So you should be able to use them. What error are you getting when you compile?
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account