Psychological Line — the percentage of the last period bars that
closed up, bounded 0..100:
psy =100 · count(close > prevClose) / period
Appends one column; undefined for the first period rows.
The simplest sentiment measure there is: it throws away the size of every
move and counts only its sign, so it says how persistent a move has been
rather than how big. Above 75 is conventionally read as over-optimistic and
below 25 as over-pessimistic. It is the count-only sibling of
chandeMomentum, which weights the same up/down split by magnitude —
a run of twelve tiny gains reads 100 here and modestly on CMO, which is
exactly the difference the study is for.
Definition
Standard, and short enough that the only choices are the ones named below.
TA-Lib has no Psychological Line, so the oracle is a pandas replication
with the analytic first-valid bar asserted, not a vendor cross-check. The
period 12 default is the usual Japanese convention (the study is a
Japanese-charting staple); 10, 12 and 24 all appear in print.
Edges
An unchanged close is not an up bar. The test is strictly >, so a
flat bar counts toward the denominator and not the numerator, and a
perfectly flat window reads 0 rather than 50 or undefined. That is
a real reading here, not a 0/0 — the denominator is period, a
positive integer, never the data — which is the one place this study
differs from every other ratio in the momentum family. (Some vendors
count an unchanged bar as half. That is a different study, and this one
states which it is rather than leaving it to be discovered.)
Warm-up is period rows, not period − 1: a bar's direction needs
its predecessor, so bar 0 has none and the first full window of directed
bars ends on bar period.
A bar whose close is missing has no direction, and neither does the
bar after it (whose predecessor is the gap) — so both drop out and every
window containing either is undefined. The alternative, counting an
unknown bar as not up, would report a definite percentage computed from
a bar nobody knows the direction of; the array door's rule is the honest
one. So the gap bar and the period bars after it are undefined and the
study then recovers — exactly the rows chandeMomentum loses on
the same input, since the two read the same per-bar directions and differ
only in what they do with them.
Bounded 0..100, and quantised: with period 12 the only values it
can take are the thirteen multiples of 100/12. A chart of it is a
staircase, and that is the study, not an artefact.
Scale- and shift-invariant — it reads only the sign of each change,
so any positive scaling or constant shift of every price leaves it
identical. The strongest invariance in the momentum family, and pinned by
property tests.
A leading gap shifts the start rather than emptying the study.
Psychological Line — the percentage of the last
periodbars that closed up, bounded0..100:Appends one column;
undefinedfor the firstperiodrows.The simplest sentiment measure there is: it throws away the size of every move and counts only its sign, so it says how persistent a move has been rather than how big. Above 75 is conventionally read as over-optimistic and below 25 as over-pessimistic. It is the count-only sibling of chandeMomentum, which weights the same up/down split by magnitude — a run of twelve tiny gains reads 100 here and modestly on CMO, which is exactly the difference the study is for.
Definition
Standard, and short enough that the only choices are the ones named below. TA-Lib has no Psychological Line, so the oracle is a pandas replication with the analytic first-valid bar asserted, not a vendor cross-check. The
period 12default is the usual Japanese convention (the study is a Japanese-charting staple); 10, 12 and 24 all appear in print.Edges
>, so a flat bar counts toward the denominator and not the numerator, and a perfectly flat window reads0rather than50orundefined. That is a real reading here, not a0/0— the denominator isperiod, a positive integer, never the data — which is the one place this study differs from every other ratio in the momentum family. (Some vendors count an unchanged bar as half. That is a different study, and this one states which it is rather than leaving it to be discovered.)periodrows, notperiod − 1: a bar's direction needs its predecessor, so bar 0 has none and the first full window of directed bars ends on barperiod.undefined. The alternative, counting an unknown bar as not up, would report a definite percentage computed from a bar nobody knows the direction of; the array door's rule is the honest one. So the gap bar and theperiodbars after it areundefinedand the study then recovers — exactly the rows chandeMomentum loses on the same input, since the two read the same per-bar directions and differ only in what they do with them.0..100, and quantised: withperiod 12the only values it can take are the thirteen multiples of100/12. A chart of it is a staircase, and that is the study, not an artefact.