Restarting a bot
Created at 16 Nov 2023, 09:16
RO
Restarting a bot
16 Nov 2023, 09:16
Is there any tutorial or sample code for restarting a bot and having it pick up any existing position.
I have a working bot that creates and monitors new positions and its all working fine, however occasionally there is a need to restart the bot (like the PC reboots) and its a bit awkward if there was an open position, it would be better if it could find and use the current open position…
TIA
Rob
firemyst
21 Nov 2023, 01:30
Positions.FindAll(yourPosition.yourLabel, Symbol.Name)
You need to give each of your positions a unique label when creating them.
Then, when you start your bot, check for them if you know there's open positions:
Positions.FindAll(yourPosition.yourLabel, Symbol.Name)
@firemyst