yes could be RAM issues. the manual cautions about setting a large market history depth.
is the minimum of all disregards any other conditions, so it should be
is the minimum
after making that change I tested your trigger on six markets in time machine, with a much smaller timeframe for testing. Each time it picked the selection with the biggest price drop in that timeframe, so it looks to be working ok. Please do your testing in test mode, time machine, or small stakes.
I would suggest you put in some conditions to make sure there is a small spread between back and lay prices just to be safe, otherwise sometimes where there is a big gap your tick difference measurements could be inaccurate.