Login Page - Create Account

Support Board


Date/Time: Fri, 29 Nov 2024 00:03:56 +0000



Williams AD

View Count: 1228

[2015-01-21 15:54:35]
User28682 - Posts: 233
What is the formula for the Accumulation/Distribution Williams study?

Thanks

Tom
[2015-01-22 08:50:08]
Sierra Chart Engineering - Posts: 104368
The easiest thing for us to do at the moment is to provide you the source code:
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;
}

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2015-01-22 08:50:55
[2015-02-09 03:56:05]
User28682 - Posts: 233
Thanks, I cant quite determine the basic formula for the Accumulation/Distribution Williams study from your reply. Do you have just the formula? I cant find it online as he has several things but not sure exactly what this one is.

Thanks

Tom
[2015-02-13 21:11:50]
Sierra Chart Engineering - Posts: 104368
We will have to write out the formula in a more simple format. We will try to get this done as soon as we can.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2015-02-14 22:17:14]
Sierra Chart Engineering - Posts: 104368
Here is the formula in a more understandable format:
http://www.sierrachart.com/index.php?page=doc/doc_TechnicalStudiesReference.html#s42
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2015-02-15 17:33:07]
User28682 - Posts: 233
Thanks! So to be clear, with these facts:

If (CurrentClose > PriorClose) Then
AccumulationDistribution = AccumulationDistribution[-1] + (CurrentClose - MinimumOf(CurrentLow, PriorClose) )

Up close:

close = 58
prev close = 57
cur low = 57.25


MinimumOf(CurrentLow, PriorClose

does minimum mean the lower of 57 or 57.25?

AD = AD(-1) + (58 - 57)

With a down close and these facts:

close = 58
prev close = 59
cur high = 58.75

it would mean using the minimum of 58.75 instead of 59. That would not make sense?

Date Time Of Last Edit: 2015-02-15 17:36:04
[2015-02-15 19:02:55]
Sierra Chart Engineering - Posts: 104368

does minimum mean the lower of 57 or 57.25?
Yes



it would mean using the minimum of 58.75 instead of 59. That would not make sense?
The last part of the formula was written wrong. It should have been MaximumOf. It has been corrected.

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-03-18 14:49:27]
User708541 - Posts: 87
I see that in the "more understandable format" http://www.sierrachart.com/index.php?page=doc/doc_TechnicalStudiesReference.html#s42 you are bringing in the term 'volume'. However in reading about Williams Accum / Dist, he does not use volume in the calculation.
Then reading the Sierra source code, I don't see volume in the code.

Is this Study, using Volume in it's calculation? (hopefully not)

Another question: I'm assuming in this study that the total values from the study are cumulative (add or subtract values along the way to arrive at a constantly changing cumulative value)

Hopefully, this Study does not use Volume and the values are accumulating along the way.

I'm trying to verify if Sierra's Willams AD is the same as described here: (From Technical Analysis Book)

**To calculate Williams' Accumulation/Distribution indicator, first determine the True Range High ("TRH") and True Range Low ("TRL").
Today's accumulation/distribution is then determined by comparing today's closing price to yesterday's closing price.
If today's close is greater than yesterday's close:
If today's close is less than yesterday's close:
If today's close is equal to yesterday's close:
The Williams' Accumulation/Distribution indicator is a cummulative total of these daily values.**

Thanks for clarifying.
Date Time Of Last Edit: 2023-03-18 14:58:39
[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.
[2023-03-18 18:10:33]
User708541 - Posts: 87
I agree with you.
The reason for my post is clarified in the enclosed screen shot from Sierra's site.
In the Sierra image which is referred to, in a post found above, as a "more understandable format" there are mentions of "Volume"

There is also confusion as to what "Williams" we are referring to. There's Bill Williams and Larry Williams. It appears that both Bill and Larry have produced Accumulation / Distribution indicators. I'm specifically interested in Larry Williams' version. Larry's version does not take into account Volume. It's simply a running cumulative value of the candles high vs. close or low vs. close.
I simply wanted to clarify why the 'more understandable format' shows volume but the source code does not. Maybe the reason is due to the confusion between Bill and Larry's indicators.
imageWilliams - Accum-Dist_Sierra Version.JPG / V - Attached On 2023-03-18 18:10:22 UTC - Size: 94.68 KB - 81 views

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

Login

Login Page - Create Account