is a running sum of positive accumulation values (buying pressure)
and negative distribution values (selling pressure),
as determined by price's location within a given day's true range.
To calculate the Williams' indicator, determine:
True Range High (TRH) = Yesterday's close or today's high whichever is greater
True Range Low (TRL) = Yesterday's close or today's low whichever is less
The day's is then calculated
by comparing today's closing price to yesterday's closing price.
If today's close is greater than yesterday's close: Today's A/D = today's close - TRL
If today's close is less than yesterday's close: Today's A/D = today's close - TRH
If today's close is the same as yesterday's close then the A/D is zero.
The Williams' indicator is a cumulative total of the daily values:
Williams A/D = Today's A/D + Yesterday's Williams A/D
Williams states it's worth selling if the price makes a new high
and the indicator fails to follow suit. As well,
it's better to purchase if prices fall to a new bottom
yet the A/D indicator fails to reach a new low.
line 10:35 no viable alternative at input 'close'
//Created by user ChrisMoody with the help of Alex from Tech Support
//Williams AD + SMA of Williams AD + Change Colors based on Williams AD above or below SMA
//Williams AD = Solid Line, SMA = Circles
study(title = "Williams AD + SMA + Change Colors", shorttitle="WAD-SMA-ChangeColors", precision=0)
len = input(57, minval=1, title="SMA Length")
trl = min(close, low)
trh = max(close, high)
ad = close > close ? close - trl : close =ma ? lime : red
wad = cum(ad)
ma = sma(cum(ad), len)
spanColor = wad>=ma ? lime : red
p1 = plot(wad, title="Williams AD", style=line, linewidth=4, color=spanColor)
p2 = plot(ma, title="SMA",style=circles, linewidth=3, color=spanColor)
fill(p1, p2, color=silver, transp=40, title="Fill")
Go up to the chart and click on the STAR at the Top Left of the chart right under the Thumbs Up .
Then Go to one of your charts and on the top left of the screen you will see your picture or the blue icon.
Click on your picture or the blue icon and select Ideas Following (When you clicked on the Star you followed the Charts idea)
Once you select Ideas Following then click on the chart that looks exactly like the one at the top of this screen.
Once the Chart pulls up at the top right of the chart is a little transparent box with a arrow pointing to the right.
Click on that Arrow and then on the bottom left you will see a Box that says MAKE IT MINE
After you do that the Chart will come up and you can click on the "Brackets" to open the source code and click SAVE and it will be - your indicator.
The indicator will be located under Custom Scripts in your Indicators Tab.
On the chart above on the top right corner there is a box with a white arrow.
Click that and choose make it mine.
Then click on the curly brackets to reveal the code.
Open a new blank chart
Open the Script editor
Delete the existing code in there
Paste the code you copied from my chart
Then open the indicators tab...
Go to Custom Scripts
The indicator will be in there
Click on it and it will be applied to your chart....
Let me know if you get it to work