Williams %R (Amibroker And Tradestation Code)

The original article about the Williams %R indicator can be found here.

 

Amibroker code:

This is the code for Williams %R (5-day):

Williams %R = ( ( HHV(H,Length) – Close ) / ( HHV(H,length) – LLV(L,length) ) ) * -100 ;
Plot(Williams %R,”Williams %R”,colorRed,styleLine);

Tradestation code:

 

inputs: Length( numericsimple ) ;
variables: HH( 0 ), Divisor( 0 ) ;

HH = Highest( High, Length ) ;
Divisor = HH – Lowest( Low, Length ) ;

if Divisor <> 0 then
PercentR = 100 – ( ( HH – Close ) / Divisor ) * 100
else
PercentR = 0 ;

 

Disclaimer: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinion – they are not suggestions to buy or sell any securities.