@Justujuewafa Ok. Let's begin by removing block 11. It is redundant. Then I see you open an initial buy and a sell. That means 2 trades. But block 15 is only searching for the latest open trade. That means it will only be the initial sell. Is that intentional or should both buy and sell be considered?