Signature | Description | Parameters |
---|---|---|
#include <DataFrame/DataFrameFinancialVisitors.h> template<typename T, typename I = unsigned long, std::size_t A = 0> struct EaseOfMovementVisitor; // ------------------------------------- template<typename T, typename I = unsigned long, std::size_t A = 0> using eom_v = EaseOfMovementVisitor<T, I, A>; |
This is a “single action visitor”, meaning it is passed the whole data vector in one call and you must use the single_act_visit() interface. This visitor calculates the Ease Of Movement (EOM) indicator. It requires 4 input columns in order of low price, high price, close price, volume. Richard Arms' Ease of Movement indicator is a technical study that attempts to quantify a mix of momentum and volume information into one value. The intent is to use this value to discern whether prices are able to rise, or fall, with little resistance in the directional movement. When the indicator creates output values above zero and rising, this suggests that the price is increasing on low volume, while falling negative values suggest that the price is dropping on low volume. explicit EaseOfMovementVisitor(size_t roll_period = 14, value_type vol_divisor = 100,000,000); roll_period: The averaging period vol_divisor: Scale equals 1,000 to 1,000,000,000 depending on the average daily volume of the stock. The more heavily traded the stock, the higher the scale should be to keep the indicator value in single or double digits |
T: Column data type I: Index type A: Memory alignment boundary for vectors. Default is system default alignment |
static void test_EaseOfMovementVisitor() { std::cout << "\nTesting EaseOfMovementVisitor{ } ..." << std::endl; typedef StdDataFrame64<std::string> StrDataFrame; StrDataFrame df; try { df.read("data/SHORT_IBM.csv", io_format::csv2); eom_v<double, std::string> eom; df.single_act_visit<double, double, double, long>("IBM_Low", "IBM_High", "IBM_Close", "IBM_Volume", eom); assert(eom.get_result().size() == 1721); assert(std::isnan(eom.get_result()[0])); assert(std::isnan(eom.get_result()[12])); assert(std::abs(eom.get_result()[14] - -0.9462) < 0.0001); assert(std::abs(eom.get_result()[16] - -11.3211) < 0.0001); assert(std::abs(eom.get_result()[25] - -29.6584) < 0.0001); assert(std::abs(eom.get_result()[1720] - -36.4666) < 0.0001); assert(std::abs(eom.get_result()[1712] - -12.0302) < 0.0001); assert(std::abs(eom.get_result()[1707] - -1.0561) < 0.0001); } catch (const DataFrameError &ex) { std::cout << ex.what() << std::endl; } }