// Update the current EMAdifference (see design documentation), perform // required steps at the current state and then find the next FSM state void PairsTrading::doPairsTrading(double current_money, void *m_pclient) { // Calculate EMAdifference and return if EMAs are not yet valid if (calculateDiff() == false) return; // Debugging only fTest << "Entering state " << state << ", EMA diff: " << EMAdifference << ", ccount: " << correlatedCount; // handle current state if (state == 1) State1(); else if (state == 2) State2(); else if (state == 3) State3(current_money, m_pclient); else State4(m_pclient); // Debugging only fTest << ". Leaving state " << state << std::endl; }
void stepMax ( T val ) { this->setMax(this->maxVal_ + val); calculateDiff(); }
void stepMin ( T val ) { this->setMin(this->minVal_ + val); calculateDiff(); }