In https://www.quantopian.com/posts/time-frame-based-indicator, Jay Deng asked about how to implement Time Range and Average Time Range indicators in Python for Quantopian. Eddie Hebert posted some sample code at https://www.quantopian.com/posts/average-true-range-basic-implementation.
The code I'm posting here improves on Eddie's implementation in two ways: (1) it encapsulates the functionality in easy-to-use Python classes, and (2) it implements both True Range and Average True Range (I think the thing that Eddie called Average True Range was actually True Range).