示例#1
0
// 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; 
}
示例#2
0
 void stepMax ( T val ) {
     this->setMax(this->maxVal_ + val);
     calculateDiff();
 }
示例#3
0
 void stepMin ( T val ) {
     this->setMin(this->minVal_ + val);
     calculateDiff();
 }