Revert "Revert "Fixed ATR""

This reverts commit 4ae7c7026de795e6688c3abb8189111fcda01d4d.