Login Page - Create Account

Support Board


Date/Time: Mon, 23 Jun 2025 19:40:27 +0000



Post From: Sierra should allow ability to treat +/- FLT_MAX like it does sc.Subgraph[].DrawZeros=0

[2022-02-13 15:38:05]
User431178 - Posts: 718
How to create a study that can display -1, 0, 1 when a condition is true and not display anything when the condition is false?

If all you are interested in is the visual effect, I have already presented a very simple solution, one that works within the existing framework.

SCSFExport scsf_FLT_MAX_Test(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_SG0 = sc.Subgraph[0];
  
  if (sc.SetDefaults)
  {
    sc.GraphName = "zzz_FLT_MIN_Test";
    sc.AutoLoop = 1;
    sc.DrawZeros = 0;
    sc.GraphRegion = 1;
    sc.DrawStudyUnderneathMainPriceGraph = 0;

    Subgraph_SG0.Name = "SG0";
    Subgraph_SG0.DrawStyle = DRAWSTYLE_POINT;
    Subgraph_SG0.LineWidth = 10;
    Subgraph_SG0.PrimaryColor = RGB(0, 255, 0);

    return;
  }

  int mod = sc.Index % 8;

  switch (mod)
  {
  case 0:
    Subgraph_SG0[sc.Index] = 0;
    break;
  case 1:
  case 7:
    Subgraph_SG0[sc.Index] = -1.0f;
    break;
  case 2:
  case 6:
    Subgraph_SG0[sc.Index] = FLT_MIN;
    break;
  case 3:
  case 5:
    Subgraph_SG0[sc.Index] = 1.0f;
    break;
  case 4:
    Subgraph_SG0[sc.Index] = 0;
    break;
  default:
    break;
  }
}

Anyway, time to bow out now, life is too short.
imageFLT_MIN.png / V - Attached On 2022-02-13 15:35:12 UTC - Size: 30.7 KB - 222 views