If the price moves up enough past the highest sell, the bot will create ten more sells at higher prices with userrefs that are each one million lower than the previous one. The userref of the tenth sell will be the SAME userrref as the FIRST buy that gets added when the price drops below the lowest buy, causing a userref collision.
The fix for this that I'm planning is to create the 10-digit userref (INT32) from the trade information so that is it forced to be unique. I propose that the ten digits of the userref will be determined thus:
Digit 1: 1 for buy, 2 for sell (A sell with a userref that starts with 1 resulted from the execution of a buy command)
Digits 2&3: Position in the list of pairs at the beginning or report()
Digits 4-10: Leading zeroes and all (up to 7) digits of the price.
If the price moves up enough past the highest sell, the bot will create ten more sells at higher prices with userrefs that are each one million lower than the previous one. The userref of the tenth sell will be the SAME userrref as the FIRST buy that gets added when the price drops below the lowest buy, causing a userref collision.
The fix for this that I'm planning is to create the 10-digit userref (INT32) from the trade information so that is it forced to be unique. I propose that the ten digits of the userref will be determined thus: Digit 1: 1 for buy, 2 for sell (A sell with a userref that starts with 1 resulted from the execution of a
buy
command) Digits 2&3: Position in the list of pairs at the beginning orreport()
Digits 4-10: Leading zeroes and all (up to 7) digits of the price.