# Financial formulas: Macro to calculate Williams %R

#### datalyst

##### New Member
I am working on this project which needs to calculate Williams %R momentm indicator and then draw a bar chart for the result. I am just not able to get started. any help on this will be really appreciated.

#### tweedle

##### Well-known Member
Welcome!

Do you mean a stock chart? High, Low & Close?

#### datalyst

##### New Member
Hello T,

Finally i found a solution to this. now that i know how to calculate Will%R, I am looking to implement this. shall i make a UI form to get inputs form the user? how is "period" used to calculate this %age?

you may want to take a look at this:
http://stockcharts.com/h-sc/ui?c=INTC,UU[L,A]DACLNIMY[P][VC60][IUK14]

scroll to the bottom of the page and there you will see a section called indicators. you can select an indicator and define period.

#### tweedle

##### Well-known Member
The time-slice is whatever you define, or whatever is specified to you.
In the case of stocks, it's usually the high, low, close for the day.
If you're mapping tides, and measure the same time every day for a 15 days, then you would take the high, low and close (last reading) to date and graph those 3 values. If you're graphing petrol prices, you can take readings every n periods and graph the h/l/c in the defined range. The point is in graphing the 3 measurements. The Low has to be the lowest value for the period, the High has to be the highest value for the period, and the close has to be somewhere >=Low AND <= High. It's a measure of agression for the period.
How you acquire the periodic measurements is up to you and your requirement.

Edit: The period simply defines which set of records to use to select H/L/C from.

Last edited: