I'd like to share an implementation of the trSum indicator, which is a useful measure of volatility derived from the True Range (TR) indicator. The True Range is defined as the greatest of the following values:

  1. The difference between the current period's high and low prices.
  2. The absolute value of the difference between the current period's high price and the previous period's close.
  3. The absolute value of the difference between the current period's low price and the previous period's close.

The trSum indicator is simply a rolling sum of the True Range values over a specified number of periods, as defined by the length parameter. It can be helpful in identifying potential trend changes or setting stop-loss orders.

I'm sharing this indicator with the community in the hope that it might be useful to other traders and analysts.

Best regards, Papa Bear

Author