Indicator HKU_API SAFTYLOSS(const Indicator& data, int n1, int n2, double p) { IndicatorImpPtr result = make_shared<SaftyLoss>(); result->setParam<int>("n1", n1); result->setParam<int>("n2", n2); result->setParam<double>("p", p); result->calculate(data); return Indicator(result); }
Indicator HKU_API WEAVE(const Indicator& ind1, const Indicator& ind2) { if (!ind1.getImp() || !ind2.getImp()) { HKU_ERROR("ind1 or ind2 is Null Indicator! [WEAVE]"); return Indicator(); } IndicatorImpPtr p = make_shared<IndicatorImp>(); p->add(IndicatorImp::WEAVE, ind1.getImp(), ind2.getImp()); return p->calculate(); }
HKU_API Indicator operator+(const Indicator& ind1, const Indicator& ind2) { if (!ind1.getImp() || !ind2.getImp()) { return Indicator(); } IndicatorImpPtr p = make_shared<IndicatorImp>(); p->add(IndicatorImp::ADD, ind1.getImp(), ind2.getImp()); return p->calculate(); }
Indicator Indicator::operator()(const Indicator& ind) { if (!m_imp) return Indicator(); if (!ind.getImp()) return Indicator(m_imp); IndicatorImpPtr p = m_imp->clone(); p->add(IndicatorImp::OP, IndicatorImpPtr(), ind.getImp()); return p->calculate(); }
Indicator HKU_API IF(const Indicator& ind1, const Indicator& ind2, const Indicator& ind3) { if (!ind1.getImp() || !ind2.getImp() || !ind3.getImp()) { HKU_ERROR("Exists null indicator! [IF]"); return Indicator(); } IndicatorImpPtr p = make_shared<IndicatorImp>(); p->add_if(ind1.getImp(), ind2.getImp(), ind3.getImp()); return p->calculate(); }
Indicator HKU_API DIFF(const Indicator& data) { IndicatorImpPtr p = make_shared<Diff>(); p->calculate(data); return Indicator(p); }
Indicator HKU_API CVAL(const Indicator& ind, double value) { IndicatorImpPtr p = make_shared<ConstantValue>(); p->setParam<double>("value", value); p->calculate(ind); return Indicator(p); }
Indicator HKU_API WEAVE(const Indicator& ind) { IndicatorImpPtr p = make_shared<Weave>(); p->calculate(ind); return Indicator(p); }
Indicator HKU_API REF(const Indicator& ind, int n) { IndicatorImpPtr p = make_shared<RightShift>(); p->setParam<int>("n", n); p->calculate(ind); return Indicator(p); }
Indicator HKU_API LLV(const Indicator& ind, int n =20) { IndicatorImpPtr p = make_shared<LowLine>(); p->setParam<int>("n", n); p->calculate(ind); return Indicator(p); }