Find where a trend turns
Read which way a series is heading, how long it has held that way, and where it turns, with no threshold to choose (flow).
$ cat latency.txt
12 15 40 180 950 3100 800 95 20 18
Where the series turns
A reversal is a token where the trend flips between rising and falling; the peak momentum is the token ending the longest run one way:
$ trex flow latency.txt --reversals
trex flow (signal magnitude): 35 bytes, 10 tokens, 1 reversal(s)
peak momentum: 6 (rising)
reversals (1):
@ 26 95 20 18
The slope at a token is the change per token averaged over the four tokens ending at it, so the trend turns a token or two after the top: 3100 is the largest value, and the series reads as falling from 95. The magnitude axis names the top itself.
Every step of the trend
Each token’s frame carries its slope, its direction and how many tokens in a row have held it:
$ trex flow latency.txt --field
trex flow (signal magnitude): 35 bytes, 10 tokens, 1 reversal(s)
peak momentum: 6 (rising)
per-token (token -> slope | direction | momentum):
12 slope= +0.00 -- mom=0
15 slope= +0.10 up mom=1
40 slope= +0.26 up mom=2
180 slope= +0.39 up mom=3
950 slope= +0.47 up mom=4
3100 slope= +0.58 up mom=5
800 slope= +0.33 up mom=6
95 slope= -0.07 down mom=1
20 slope= -0.42 down mom=2
18 slope= -0.56 down mom=3
A slope within 0.05 of zero is steady, and a steady token ends no run and starts none.
The trend of another signal
The trend is of each token’s magnitude unless another signal is named: its nesting depth, as the stress axis reads it, or its length in bytes. The depth of a nested call deepens for eleven tokens and turns at the first closing bracket:
$ trex flow --signal stress --text 'f(a, g(b, h(c, d)), e)' --reversals
trex flow (signal stress): 22 bytes, 18 tokens, 1 reversal(s)
peak momentum: 11 (rising)
reversals (1):
@ 17 ), e)
--signal length, -Signal Length and signal="length" read the trend of token lengths.