Help required for a simple pair trading strategy

See this existing topic: How to do pair switching logic in AFL?