Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 01:42:06 +0000



[Programming Help] - Display indicator in future

View Count: 602

[2020-07-21 14:02:53]
gfx2trade - Posts: 48
Hello SC Team,

Trying to display on chart SSB indicator.
I us both the native SC study (Green) and the one created with the below code (blue).

I don't understand why the blue line does not overlap the green in the future.

Thks for helping


SCSFExport scsf_gfxSSB(SCStudyInterfaceRef sc)
{
  
  // Graphs & Input

    SCSubgraphRef Subgraph_H = sc.Subgraph[0];
    SCSubgraphRef Subgraph_L = sc.Subgraph[1];
    SCSubgraphRef Subgraph_M = sc.Subgraph[2];
    
  
  // Working
    //float myHigh = 0;
    //float myLow = 0;
    //float myMid = 0;
    
    SCFloatArray myHigh;
    SCFloatArray myLow;
    SCFloatArray myMid;
  
  // Section 1 - Set the configuration variables and defaults
  if (sc.SetDefaults)
  {
    sc.GraphName = "TEST SSB;
    sc.StudyDescription = "This is the gfx SSB indicator";
    sc.DrawZeros = false;
    sc.GraphRegion = 0;
    sc.ValueFormat = sc.BaseGraphValueFormat;
    
    
    
    Subgraph_M.Name = "RBM";
    Subgraph_M.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_M.LineWidth = 2;  //Width of arrow
    Subgraph_M.PrimaryColor = RGB (0, 0, 255); // Green
        
    sc.AutoLoop = 1;
    
    sc.AlertOnlyOncePerBar = true;
    
    return;
  }
    
  // ************************************  
  // Section 2 - Do data processing here
  // ************************************  
  
  int index = sc.Index;
  int OutputIndex = index + 26;
  
  int CalculationStartIndex = max(0, sc.UpdateStartIndex - 2);
  sc.EarliestUpdateSubgraphDataArrayIndex = CalculationStartIndex;
  
  sc.Highest(sc.BaseDataIn[SC_HIGH], Subgraph_H, 52);
  sc.Lowest(sc.BaseDataIn[SC_LOW], Subgraph_L, 52);
  
  myHigh[index] = Subgraph_H[index];
  myLow[index] = Subgraph_L[index];
  myMid[index] = (myHigh[index] + myLow[index]) / 2 ;
  Subgraph_M[OutputIndex] = myMid[index];
      
}

Date Time Of Last Edit: 2020-07-21 14:03:19
imageCapture.JPG / V - Attached On 2020-07-21 14:01:49 UTC - Size: 32.58 KB - 263 views
[2020-07-21 14:39:25]
User907968 - Posts: 802
Maybe this -
ACSIL Interface Members - sc.Subgraph Array: sc.Subgraph[].ExtendedArrayElementsToGraph
[2020-07-21 19:08:23]
gfx2trade - Posts: 48
Indeed

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

Login

Login Page - Create Account