Support Board
Date/Time: Wed, 15 Jan 2025 15:32:01 +0000
Trying To Get Color Through sc.Input
View Count: 1203
[2017-08-16 01:22:57] |
CustomIndicators - Posts: 126 |
When I call to get the color from my input, it seems to be returning 0. When I take a peak at the study settings once loaded onto a chart, I'm finding that the color setting is set to black. You can clearly see in my code, I didn't set that to black. What is going wrong? Here are portions of my code: const int HMH_COLOR = 10; SCSFExport scsf_Study(SCStudyInterfaceRef sc) { SCInputRef HMHColor = sc.Input[HMH_COLOR]; if (sc.Defaults) { HMHColor.Name = "Background Color When Over Extended Up"; HMHColor.SetColor(RGB(255, 255, 255)); // White } if (sc.Subgraph[OSCILLATOR][sc.Index] > sc.GetPersistentFloat(PEAK_ONE)) { // Tried this: Returns 0 unsigned int color = sc.Input[HMH_COLOR].GetColor(); sc.ChartBackgroundColor = color; // Tried this too: Returns 0. unsigned int otherColor = HMHColor.GetColor(); // <- Just so I can see the returned value sc.ChartBackgroundColor = HMHColor.GetColor(); } } Date Time Of Last Edit: 2017-08-16 01:23:37
|
[2017-08-16 02:22:13] |
Sierra Chart Engineering - Posts: 104368 |
We see no problem when testing it with the following code: SCSFExport scsf_TestFunction4(SCStudyInterfaceRef sc)
{ if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "Test Function 4"; sc.AutoLoop = 0; sc.FreeDLL = 0; sc.GraphRegion = 0; sc.Subgraph[0].Name = "Test"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE; sc.Subgraph[0].LineWidth = 2; sc.Input[0].Name = "Color"; sc.Input[0].SetColor(128, 128, 128); return; } unsigned int ColorValue = sc.Input[0].GetColor(); } Also this code block in your function is missing a return: if (sc.Defaults) Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2017-08-16 02:23:16
|
To post a message in this thread, you need to log in with your Sierra Chart account: