trading algorithm fixed!