Login Page - Create Account

Support Board


Date/Time: Wed, 09 Apr 2025 09:53:12 +0000



Post From: Williams AD

[2023-03-18 17:14:56]
User90125 - Posts: 715
Here's the code I found in SC for Williams Accumulation Distribution from SCStudyFunctions.cpp & Studies5.cpp:

/*==========================================================================*/ 
SCFloatArrayRef WilliamsAD_S(SCBaseDataRef BaseDataIn, SCFloatArrayRef Out, int Index) 
{ 
  if(Index > 0) 
  { 
    if (BaseDataIn[SC_LAST][Index] > BaseDataIn[SC_LAST][Index - 1]) 
      Out[Index] = Out[Index - 1] + (BaseDataIn[SC_LAST][Index] - min(BaseDataIn[SC_LOW][Index], BaseDataIn[SC_LAST][Index - 1])); 
 
    else if (BaseDataIn[SC_LAST][Index] == BaseDataIn[SC_LAST][Index - 1]) 
      Out[Index] = Out[Index - 1]; 
 
    else if (BaseDataIn[SC_LAST][Index] < BaseDataIn[SC_LAST][Index - 1]) 
      Out[Index] = Out[Index - 1] + 
      ( BaseDataIn[SC_LAST][Index] - max(BaseDataIn[SC_HIGH][Index], BaseDataIn[SC_LAST][Index - 1]) ); 
  } 
  else 
    Out[Index] = 0; 
   
  return Out; 
} 
 
 
 
/*==========================================================================*/


/*==========================================================================*/ 
SCSFExport scsf_WilliamsAD(SCStudyInterfaceRef sc) 
{ 
  SCSubgraphRef Subgraph_AccumulationDistribution = sc.Subgraph[0]; 
 
  if(sc.SetDefaults)   
  { 
    sc.GraphName="Accumulation/Distribution (Williams)"; 
 
    sc.GraphRegion = 1; 
    sc.ValueFormat = 2; 
 
    Subgraph_AccumulationDistribution.Name = "AD"; 
    Subgraph_AccumulationDistribution.DrawStyle = DRAWSTYLE_LINE; 
    Subgraph_AccumulationDistribution.PrimaryColor = RGB(0,255,0); 
 
 
    sc.AutoLoop = 1; 
 
     
     
 
    return; 
  } 
 
  sc.DataStartIndex = 1; 
 
  sc.WilliamsAD(sc.BaseDataIn, Subgraph_AccumulationDistribution, sc.Index); 
 
} 
 
/*==========================================================================*/

It is consistent with the original Williams' Accumulation/Distribution indicator, as I don't see anything relating to Volume in this code.

Perhaps SC could verify and update the Technical Studies Reference accordingly.