# BCDI Formula
[TOC]
## Price Percentile (PP)
percentile = ratio of number of prices points below the current price over the total number of points in the time frame.
Given $n$ close values $x_0,\ldots,x_{n-1}$, then
$$
\text{pp} = \frac{\sum_{i=0}^{n-1} [x_i \leq x_{n-1}]_1}{n}
$$
where $[\textit{condition}]_1$ = 1 if $\textit{condition}$ is true, otherwise 0.
## Volatility (Vol)
Volatility is the standard deviation of logarithmic returns.
Given $n$ close values $x_0,\ldots,x_{n-1}$, then
$$
\text{vol} = \sqrt{ \frac{1}{n-1} \sum_{i=1}^{n-1} \left( \ln\left(\frac{x_i}{x_{i-1}}\right) - \bar{x} \right)^2 }
\quad\text{with}\quad
\bar{x} = \frac{1}{n-1} \sum_{i=1}^{n-1} \ln\left(\frac{x_i}{x_{i-1}}\right) \,.
$$
TODO: this is not yet annualized
## AnnRoC = geoPAK
annualized return on capital (AnnRoC) = Geometrische Per Annum Kursentwicklung (geoPAK).
Given $n$ close values $x_0,\ldots,x_{n-1}$ at time points $t_i$ measured in years, then the total return $r$ is
$$
\begin{aligned}
r &= \frac{x_{n-1} - x_0}{x_0} = \frac{x_{n-1}}{x_0} - 1 \\
&= \prod_{i=1}^{n-1} \frac{x_i}{x_{i-1}} - 1
= \exp\left(\ln\left(\prod_{i=1}^{n-1} \frac{x_i}{x_{i-1}}\right)\right) - 1 \\
&= \exp\left(\sum_{i=1}^{n-1}\ln\left( \frac{x_i}{x_{i-1}}\right)\right) - 1 \,.
\end{aligned}
$$
The annualized return $\bar{r}$ is
$$
\text{AnnRoC}_n = \bar{r} = (1 + r)^{1/(t_{n-1}-t_0)} - 1\,,
$$
where $(t_{n-1}-t_0)$ is the total number of years in the time interval (or fraction thereof).
The previous calculation can be combined with the exp-ln equation:
$$
\begin{aligned}
\bar{r}
&= \exp\left(\sum_{i=1}^{n-1}\ln\left( \frac{x_i}{x_{i-1}}\right)\right)^{1/(t_{n-1}-t_0)} - 1 \\
&= \exp\left(\tfrac{1}{(t_{n-1}-t_0)}\sum_{i=1}^{n-1}\ln\left( \frac{x_i}{x_{i-1}}\right)\right) - 1 \\
&= \exp\left(\frac{\sum_{i=1}^{n-1}\ln\left( \frac{x_i}{x_{i-1}}\right)}{\sum_{i=1}^{n-1}(t_{i}-t_{i-1})}\right) - 1
\end{aligned}
$$
ALT und FALSCH:
$$
\text{AnnRoC}_n = \exp\left(\frac{1}{n}\sum_{i=1}^n
\ln\left[\left( \frac{c_i}{c_{i-1}}\right)^{1/(t_i - t_{i-1})} \right]\right) - 1.0
$$
## Sharpe Ratio
The Sharpe ratio is the annualized return divided by the annualized volatility.
## WinProb = Gewinn-Konstanz (GK)
Probability of not losing money over any period (WinProb) = Gewinn-Konstanz (GK).
Gegeben sind $n$ Schlusskurse $c_i$ zu Zeitpunkten $t_i$ gemessen in Jahren.
$$
\text{WinProb}_n = \frac{1}{n(n-1)/2} \sum_{i=0}^n \sum_{j=i+1}^n [c_i \leq c_j]_1
$$
wobei $[\textit{condition}]_1$ = 1 wenn $\textit{condition}$ wahr ist sonst 0.
## C-Gewinn "Gewinnperspektive"
"Erwartete" Annualisierte Rendite
$$
\text{CGewinn}_n = \text{AnnRoc}_n \cdot \text{WinProb}_n
$$
## LossRatio = Verlust-Ratio
Aus dem boerse.de Aktienbrief:
"Die Verlust-Ratio ist eine Kennzahl, in der die Wahrscheinlichkeit eines Kursverlustes mit dem gewichteten Durchschnittsverlust ins Verhältnis gesetzt wird. Die Wahrscheinlichkeit ergibt sich aus der Anzahl der Verlustmonate dividiert durch die Anzahl der Monate im Beobachtungszeitraum (also 120). Der gewichtete Durchschnittsverlust ergibt sich aus der Summe aller Monats-Verluste multipliziert mit dem Monatsfaktor des jeweiligen Verlustmonats dividiert durch die Summe der Monatsfaktoren. Um die Monatsfaktoren zu ermitteln, wird jedem Monat ein absteigender Faktor zugewiesen, d.h. der letzte Monat erhält den Faktor 120, die davor 119 und der erste Beobachtungsmonat den Faktor 1. Durch dieses Vorgehen erhalten die jüngsten Verluste das höchste Gewicht."
Meine Interpretation dessen:
Given $n$ daily close values $x_0,\ldots,x_{n-1}$ at time points $t_i$ measured in years, then the weighted annualized losses $\ell$ are
$$
\ell
= \exp\left(\frac{
\sum_{i=1}^{n-1} w_i \ln\left(\frac{x_i}{x_{\max(0,i-30)}}\right)}{
\sum_{i=1}^{n-1} w_i (t_{i}-t_{\max(0,i-30)})}\right) - 1 \\
\text{with weights}\quad
w_i = [x_i \geq x_{\max(0,i-30)}]_1 \cdot \left(\frac{i+1}{n}\right)^y
$$
where $y$ is a weighting parameter and currently $y=3$.
The losses are calculated on 30-day rolling windows ($\frac{x_i}{x_{\max(0,i-30)}}$) instead of daily windows because daily losses more frequent and random.
To calculate the "loss ratio" $\bar{\ell}$, we multiply the annalized losses $\ell$ with the probability of losing $p_\ell$:
$$
\bar{\ell} = -\ell \cdot p_\ell
\quad\text{with}\quad
p_\ell = \frac{1}{n-1} \sum_{i=1}^{n-1} [x_i \geq x_{\max(0,i-30)}]_1
$$
## ATHRatio
Verlustverhältnis zum letzten all-zeit-hoch (all-time-high ATH)
Given $n$ daily close values $x_0,\ldots,x_{n-1}$, then
$$
\text{ATHRatio} = \frac{(\max_{i=0}^{n-1} x_i) - x_{n-1}}{x_{n-1}}
$$
## CRisiko
BCDI Risiko Bewertung. No further comment.
$$
\text{CRisiko} = \bar{\ell} \cdot (\text{ATHRatio} + 0.001)
$$
## CRang = Champion Rang
BCDI Champion Rang
$$
\text{CRang} = \frac{\text{CGewinn}}{\text{CRisiko}}
$$
## The End
This is the end.