Best Way to Calculate ATP both for Cash & Futures is by the AFL by Mr. Ambarish , which is available in the link below:
http://www.traderji.com/technical-a...according-karthiks-strategy-3.html#post748070
If you add a line like this at the end of the AFL
CrntBarATP=SelectedValue(ATP);
Plot(CrntBarATP,"CrntBarATP",ColorATP,styleThick);
It will draw a line on the ATP of the bar selected, which will be helpful in tracking next day's scrip movement.