Struggling to implement this simple algorithm for ECG wave delineation
I cannot find any sense on the formula exposed in the paper, but as is, the expression is just a derivative approximation, with $r=r_0$. 

$$
x'_k=\frac 1{10}(2(x_{k+2r}-x_{k-2r})+(x_{k+r}-x_{k-r}))\\
y_k=2(x'_k)^2
$$

That is what the paper say. 

That is, you have a signal $x$, and you calculate $x'$ as a moving average, taking samples above and below the current index.

For any given signal $x:x_1...x_n$, you will straightforwardly be able to calculate $x'$ and $y$ without trouble.