Now you are in the subtree of Finance public knowledge tree. 

MStrategy - key points

definitions

https://www.sr-sv.com/a-basic-theory-of-momentum-strategies/
https://www.sr-sv.com/the-relation-between-value-and-momentum-strategies/

implementations

signal $S_n (t) = (1/\sigma_n) (p(t-1) - aver(p(t-1)) )$

where $p(t-1)$ is the price on the previous step
$aver(p(t-1))$, as an exponential moving average of past prices (excluding $p(t)$ itself) with a decay rate equal to n months

quasi-PL $Q_n (t) = \sum_{t' (for t' < t)} sign (S_n (t') ) * \frac{p_n (t'+1) - p_n (t')}{\sigma_n (t'-1)}$

the excess return $r^s_t$ for instrument s in month t

The TSMOM return for any instrument s at time t is therefore:

$r^{TSMOM,s}_{t,t+1} = [ sign(r^s_{t-12,t}) \frac{40%}{\sigma^s_t} ] * r^s_{t, t+1}$

the same definition as Moskowitz

Throughout the paper, both J and K are measured in months, weeks or days depending on the rebalancing frequency of interest.
We use the notation to denote monthly strategies with a lookback and holding period of J and K months respectively

$R^{K, MOM}_J (t,t+K) = [ sign(R^s_{t-J,t}) \frac{40%}{\sigma (t; 60) } ] * R (t, t+K)$

https://en.wikipedia.org/wiki/Moving_average