Williams Accumulation/Distribution (WAD)

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Williams Accumulation/Distribution (WAD)

Postby Alexander.Gettinger » Fri Apr 30, 2010 12:33 pm

WAD.png


Williams AD is the accumulated sum of positive "accumulational" and negative "distributional" price movements.

Calculation:

To calculate the accumulation/distribution indicator, first you have to find a "True Range High" (TRH) and "True Range Low" (TRL):

TRH (i) = MAX (HIGH (i) || CLOSE (i - 1))
TRL (i) = MIN (LOW (i) || CLOSE (i - 1))

Then you must find the current value of accumulation/distribution by comparing today and yesterday's closing prices.

1. If the current closing price is higher than the previous one, then:

CurА/D = CLOSE (i) - ТRL (i)

2. If the current closing price is lower than the previous one, then:

CurА/D = CLOSE (i) - ТRH (i)

3. If current and previous closing prices coincide then:

CurА/D = 0

Williams accumulation/distribution indicator is a growing sum of these values for each day:

WА/D (i) = CurА/D + WА/D (i - 1)

Where:
TRH (i) — the True Range High;
TRL (i) — the True Range Low;
MIN — the minimum value;
MAX — the maximum value;
|| — the logical OR;
LOW (i) — the minimum price of the current bar;
HIGH (i) — the maximum price of the current bar;
CLOSE (i) — the closing price of the current bar;
CLOSE (i - 1) — the closing price of the previous bar;
CurА/D — means current value of accumulation/distribution;
WА/D (i) — the current value of Williams Accumulation/Distribution indicator;
WА/D (i - 1) — the value of Williams Accumulation/Distribution indicator on the previous bar.


Code: Select all
function Init()
    indicator:name("Williams Accumulation/Distribution (WAD)");
    indicator:description("Williams Accumulation/Distribution (WAD)");
    indicator:requiredSource(core.Bar);
    indicator:type(core.Oscillator);
   
    indicator.parameters:addColor("clrWAD", "Color of WAD", "Color of WAD", core.rgb(0, 255, 0));
end

local first;
local source = nil;
local WAD;

function Prepare()
    source = instance.source;
    first=source:first()+2;
    local name = profile:id() .. "(" .. source:name() .. ")";
    instance:name(name);
    WAD = instance:addStream("WAD", core.Line, name .. ".WAD", "WAD", instance.parameters.clrWAD, first);
end


function Update(period, mode)
    if (period>first+1) then
     local TRH=math.max(source.high[period],source.close[period-1]);
     local TRL=math.min(source.low[period],source.close[period-1]);
     local AD;
     if source.close[period]>source.close[period-1]+source:pipSize() then
      AD=source.close[period]-TRL;
     elseif source.close[period]<source.close[period-1]-source:pipSize() then
      AD=source.close[period]-TRH;
     else
      AD=0.;
     end
     WAD[period]=WAD[period-1]+AD;
    else
     WAD[period]=0.;
    end
end


WAD.lua
(1.21 KiB) Downloaded 1515 times

WAD Price Overlay.lua
(2.83 KiB) Downloaded 984 times
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Williams Accumulation/Distribution (WAD)

Postby Jeffreyvnlk » Wed May 29, 2013 11:35 am

Can i ask who Williams ? Larry Williams or Bill Williams ? I guess it is Larry
Jeffreyvnlk
FXCodeBase: Graduate
 
Posts: 302
Joined: Wed Apr 11, 2012 2:17 pm

Re: Williams Accumulation/Distribution (WAD)

Postby Apprentice » Sun Jun 02, 2013 11:31 am

Williams Accumulation Distribution was created by Larry Williams.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36437
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Williams Accumulation/Distribution (WAD)

Postby Jeffreyvnlk » Mon Aug 12, 2013 8:06 am

Now I realized this indicator was just a part of Williams AD formula because the volume element was taken out. However I expressed thank to Alexander for bringing this up because IMHO, tick volume is kind of joke so AD without volume might be more practical in Forex. Btw, you should change the name of this indicator. In his book, Larry originally called it as Net Change Price
Jeffreyvnlk
FXCodeBase: Graduate
 
Posts: 302
Joined: Wed Apr 11, 2012 2:17 pm

Re: Williams Accumulation/Distribution (WAD)

Postby Jeffreyvnlk » Mon Aug 12, 2013 10:17 am

Btw, could you make it overlay (behind the price) , please.Thank you
Jeffreyvnlk
FXCodeBase: Graduate
 
Posts: 302
Joined: Wed Apr 11, 2012 2:17 pm

Re: Williams Accumulation/Distribution (WAD)

Postby Apprentice » Tue Aug 13, 2013 2:26 am

Your request is added to the development list.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36437
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Re: Williams Accumulation/Distribution (WAD)

Postby Jeffreyvnlk » Sun Sep 07, 2014 2:21 pm

Apprentice wrote:WAD Price Overlay added.


And based on real volume appreciated. Would be a fine gem finally.Thanks
Jeffreyvnlk
FXCodeBase: Graduate
 
Posts: 302
Joined: Wed Apr 11, 2012 2:17 pm

Re: Williams Accumulation/Distribution (WAD)

Postby Apprentice » Tue Sep 09, 2014 2:24 am

As I stated already, for now it is impossible to implement real volume for use within indicators.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36437
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Williams Accumulation/Distribution (WAD)

Postby Coondawg71 » Mon Apr 13, 2015 3:00 am

Can we please request an amendment to this Williams Accumulation Distribution indicator.

I would like to see color fill between the Zero line and the indicator value.

Green if value is above Zero line.

Red if value is below Zero line.

Thanks!


sjc
Attachments
WAD fill area.png
Color fill between WAD value and Zero line
User avatar
Coondawg71
FXCodeBase: Graduate
 
Posts: 324
Joined: Sat Jan 15, 2011 11:45 am

Next

Return to Custom Indicators

Who is online

Users browsing this forum: Google [Bot] and 129 guests