1. Every day set two Stop Market Orders, first - $1 above the price, second - $1 below the price, so they shouldn't be filled at the same time, their stop prices are different

2. When one of these orders gets filled, cancel the opposite order and add StopLoss and TakProfit orders

For some days it works as expected, but at some point strategy opens two opposite orders placed at different prices, why?

Logs: only one order should be filled on 2008-01-23, either TM or BM, but not both

Author