diff (var x): var
Returns the difference of x to its value from one bar before.
||Variable for difference calculation.
x - previous x
- This function generates a series and thus must be called in a fixed order in the script.
- diff(log(x)) returns the log return of x , since log(a/b) = log(a) - log(b).
// generate a price difference serie
vars Changes = series(diff(priceClose()));
series, rev, ROCP