TRADESTATION: RELATIVE VIGOR INDEX
John Ehlers’s article “Relative Vigor Index (RVI)” in this
issue includes a version of EasyLanguage code for the
indicator. That version includes hardcoded implementations
of a symmetrically weighted moving average in three places,
and also a hardcoded implementation of two summations.
We provide an alternative version below that replaces these
hardcoded implementations with function calls. This version
produces identical results, except for minor initialization
The SWMA, also known as a triangular moving average,
can be conveniently implemented as a double simple moving
average, and this code can be separated out into a function
that can than be called from the main body of the code as
many times as necessary. TradeStation includes a TriAverage
function, but the function required here is a little more
generalized, so it we call it TriAverage_gen and provide the
code for it below, following the main indicator code.
Summation is another built-in function in TradeStation, and
we use that as is.