This script calculates the "instantaneous" first and second derivatives in a highly flexible and accurate way: namely, via zero-lag price tracking with increasingly narrow sample windows for sequential secant approximation tending towards the tangent. The slope of this tangential is the first derivative, i.e., slope.
Paired with a divergence indicator this can...
It shows the first and second derivatives (tangent line of the graph) of the SMA of a given period. If the period = 1, it shows the derivatives of the price graph itself.