Calculating the ATR and TR for DI (Directional Indicator)

I got the formula to calculate the TR i.e.
TR=max[(high−low) , abs(high−close(prev)), abs(low−close(prev))];
Now according to the requirement; we need to calculate ATR for last 14 days.

From the API we can get the OHLC value; but how can we get previous "close" value; for the current date and for last 14 days.

Please suggest.
Sign In or Register to comment.