Login Page - Create Account

Support Board


Date/Time: Mon, 23 Dec 2024 23:16:16 +0000



Post From: Calculate only on closing Tick

[2015-10-14 22:40:41]
KhaosTrader - Posts: 128
I cleaned up the code to make it more logical, but now it wont make points at all on the chart, anyway, here is the cleaned up non-working at all version..


  SCSFExport scsf_Calculator(SCStudyGraphRef sc)
{
  // Section 1 - Set the configuration variables
  
  SCSubgraphRef Marker = sc.Subgraph[0];
  // This section is only run once. Refer to documentation for further details.
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    
    sc.GraphName = "Calculator";
    
    sc.StudyDescription = "Insert study description here.";
    
    sc.AutoLoop = 1; // true
    sc.FreeDLL = 1;
    
    sc.GraphRegion = 0;
        
    Marker.Name = "Dot Marker";
    Marker.DrawStyle= DRAWSTYLE_POINT;
    Marker.PrimaryColor = RGB(255,255,255);
    Marker.LineWidth = 3;
    Marker.DrawZeros = false;
    

    return;
  }

  // Section 2 - Data processing
  int cur = sc.Index;
    
  
  //if(sc.GetBarHasClosedStatus(sc.Index-1) == BHCS_BAR_HAS_CLOSED)

    if( sc.Open[cur-1] > sc.Close[cur-1])
    {
    
      Marker[cur-1]= (sc.Low[cur-1] - 2*sc.TickSize);
      
      
    }
    {
      Marker[cur-1]= 0;
  
    }

}