01

Logarithmic vs. Arithmetic Returns

While standard arithmetic returns are intuitive, they break down over time due to compounding asymmetry (a 50% loss requires a 100% gain to recover). Log returns solve this. They are perfectly additive, symmetric, and statistically robust, making them the superior choice for predictive modeling.

Arithmetic: Rt = (PtPt-1) / Pt-1 Logarithmic: rt = ln(Pt / Pt-1)
02

Isolating Relative Strength (RS)

In quantitative finance, absolute returns are often a byproduct of a rising market. Relative Strength isolates the underlying asset's independent trajectory. By converting this into Log RS, we transform multiplicative compounding into a clean, linear series of daily outperformance.

Log_RS = Σ(rstock) − Σ(rNifty)
03

Alpha (Skill) & Beta (Risk)

By running a rolling linear regression of the stock against the Nifty, we split its performance into two variables. Beta (β) is the slope: the stock's sensitivity to the index. Alpha (α) is the intercept: the mathematical proof of a stock generating value independent of market tailwinds.

β = Cov(Rs, Rm) / Var(Rm) Rs = α + βRm + ε
04

The Z-Score Significance Filter

Just because a stock beats the market today doesn't mean the trend is real. The Z-Score calculates exactly how many standard deviations the current outperformance is from its historical mean (μ). If Z < 1.5, the move is treated as statistical noise and discarded.

Z = (RS − μRS) / σRS
05

Volatility & Drawdown Mechanics

Risk management is programmatic. Instead of rigid percentage stops, the engine calculates the Average True Range (ATR): a rolling metric of intraday volatility. The stop loss automatically widens for erratic assets and tightens for stable ones, optimizing the survival rate of the trade.

TR = max[(HL), |HCprev|, |LCprev|] Stop Level = Close − (2 × ATR14)