Now uses technical indicators to define state, refactored for MongoDB.