-
— Have you ever wanted to open a new position and let the bot manage it (or close bot’s position manually),
— but did not want to login to Haas interface and simply wanted to do it from the exchange app or website?
— This snippet allows the user to change the bot’s position directly by making orders on the exchange itself— TO BE UPDATED LATER: Currently only opens new positions, if the bot has no open position. Does not close a bot’s position. Can’t flip from Long to Short or vice versa.
— Important: this snippet is designed to be used with EnableHighFrequency() mode, but will also work without it, with a delay of 4 update cycles
— The 4 update cycles delay is implemented intentionally because otherwise this script will just mess with your bot’s regular trades (as UserPosition() and GetAllOpenPositions() sometimes desync for 1-3 update cycles).
— The snippet copies the PRICE of the position entry and also the AMOUNT of the position from the exchange.— IMPORTANT: Note that ANY position change on this pair on this account that you manually make on the exchange will be taken into account by the bot,
— even if the Trading Amount is not the same in the bot as in that manual position change— Note that all the variables used inside this snippet are not valid outside the snippet, since they are local (but of course you can change that)
— DISCLAIMER: you should read and understand how this snippet works,
— the author takes no responsibility for any losses that may occur from either
— the user not implementing the snippet properly nor for the snippet not working as expected.