The source code of most indicators can be found in include\indicators.c.

Here's peak and valley:

Code:
BOOL peak(var* a) { return (a[2] < a[1]) && (a[1] > a[0]); }
BOOL valley(var* a) { return (a[2] > a[1]) && (a[1] < a[0]); }