In this test, on 2017-08-08 (second day), it bought 100 shares each of UGAZ and DGAZ, but eventually sold:
100 shares of UGAZ (this is ok)
173 (-27, -73, -73) shares of DGAZ (not ok...)
Then proceeded to buy 246 shares of DGAZ at the market open of the next day. It was supposed to only buy 100.
I suspect something is wrong with the counting/tracking of shares, but I cannot see it. I also have the "long only" setting which seems to not trigger an error during the backtest.
The idea with this algo is to buy both stocks at the market open and sell each position with a trailing stop, or at the end of the day, whichever happens first. Mostly an experiment/curiosity with Robinhood/algorithm. This is my first attempt here, and with the python language.
After that gets sorted, I will be looking into confirming trade prices/quantities for an accurate log. Presently the log is terribly off.