ChrisMoody

Example of Basic Indicator, & How to Code Advanced Features!!!

FX:XAUUSD   Gold / U.S. Dollar
2554 40 23
Description of Williams Accumulation Distribution

Williams AD 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' Accumulation/Distribution 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 accumulation/distribution 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' Accumulation/Distribution 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.

CODES BELOW
New Link To Indicator in PineScript Library

CM_Williams AD+SMA_V1_Public

Reply
Error:
line 10:35 no viable alternative at input 'close'

with

//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")
Reply
ChrisMoody PRO tradingsam
Hey Guys there is a major issue with the code I posted. When I enter it in it looks perfect but when it save it somehow it is taking out lines or symbols.

SOLUTION:

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.
Reply
tradingsam ChrisMoody
Super!!
Reply
ChrisMoody PRO tradingsam
Thank You....
Reply
TimDj ChrisMoody
Tks Chris! Very interesting!
Reply
Thanks for the comment TimDJ...I appreciate it
Reply
KirillMironov ChrisMoody
Hi Chris I have a big request to throw the correct code of the indicator WAD+SMA colored to my mail kirko23@mail.ru very important! and it doesn't install properly!
Reply
ChrisMoody PRO KirillMironov
Try this...I posted the correct code but there was a glitch and some of the code was deleted...If you follow these instructions you will easily be able to get any code anyone posts on a chart. Once you get it installed reply to this and I will delete your comment so everyone can't see your email.

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.
Select all
Copy
Open a new blank chart
Open the Script editor
Select New
Delete the existing code in there
Paste the code you copied from my chart
Save
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
Reply
jjland PRO ChrisMoody
Hi...new here but found Williams AD + SMA solution I've been searching for. Are problems pasting resolved? I couldn't find the box with white arrow mentioned above to copy code.

I'd like to try this before going Pro.

Thanks
Reply
United States
United Kingdom
India
Deutschland
España
France
Việt Nam
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Support Priority Support Report Issue Ideas Published Followers Following Private Messages Chat Sign Out