last night Gunbot (12.9.9.2) closed a 10x leverage XBTUSD position on BitMex Testnet at a slight loss for no apparent reason (saying ROE reached, which was not the case).
[32m************************************************************************************************[39m
BEGIN ROE TRAILING LOGS FOR LONG POSITION
[32m************************************************************************************************[39m
[31m------------------------------------------------------------------------------------------------[39m
[90m2019/05/21 02:46:30[39m[33m: ROE TrailingBuy limit [39m[42m1.98[49m
[31m------------------------------------------------------------------------------------------------[39m
[90m2019/05/21 02:46:30[39m[36m: Actual ROE [39m[37m-0.44[39m[90m | [39m[36m ROE Target: [39m1.98
[31m------------------------------------------------------------------------------------------------[39m
[90m2019/05/21 02:46:30[39m[33m: ROE Stop limit [39m[41m2.02[49m
[31m------------------------------------------------------------------------------------------------[39m
[41mROE raising up: activating Stop limit!!![49m
[90mGBRT_v12.9.9.2[39m [90mXBT-USD[39m[90m@[39m[90mbitmex_testnet[39m [90mRound #[39m[90m172[39m 2019/05/21 02:46:30
from 10592
[32m************************************************************************************************[39m
[5mClosing position, ROE reached!!![0m
[32m************************************************************************************************[39m
About to close position
[90m2019/05/21 02:46:30[39m[36m: Closing position...[39m
afterwards it bought straight back in - this all was immediately before a flash crash on BitMex Testnet where XBTUSD went from ~8000 down to 6500, up to 9000 and back to ~8000 (I guess someone was practising market manipulation...), so minutes later the new position got liquidated at 7500.
So I'm wondering
1) Why would Gunbot have closed the position at a 0.44% (leveraged 4.4%) loss to begin with?
2) Has any of this to do with the flash crash? (i.e. would the indicators have predicted the crash, suggesting to get out, which would be great, but then why would the bot buy back in immediately after?)