Then, when I closed out a trade, I could reflect on how well these criteria had worked. It occurred to me that if I wrote those criteria into formulas (now more fashionably called algorithms) and then ran historical data through them, I could test how well my rules would have worked in the past.