Congestion Index

All functions · nseries package

CongestionIndex

func (s Series) CongestionIndex(h, l, c Series, n int) Series

CongestionIndex implements Markos Katsanos’s Congestion Index (as described in his book “Intermarket Trading Strategies”).

The output is roughly -100 to 100, a percentage rate of change over the range as a fraction of the low. The warm-up reads 0, not NaN: bars 0 to n-2 are 0, which reads as congestion.

If h, l and c differ in length the result is an empty Series. Otherwise it has their length, and every bar is 0 when n < 2 or n > len(h): a history shorter than the window gives zeros rather than an empty Series, so CongestionIndex over a prefix of the bars is that prefix of CongestionIndex over all of them. Releases before this change returned an empty Series when n < 2 or n > len(h). The receiver is not used; a nil receiver gives the same result.