Login Page - Create Account

Support Board


Date/Time: Wed, 15 Jan 2025 15:28:24 +0000



Post From: Trying To Get Color Through sc.Input

[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