How to keep value of variable when the bot crash

Created at 11 Sep 2023, 03:18
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
BA

baolinhhk6

Joined 01.02.2023

How to keep value of variable when the bot crash
11 Sep 2023, 03:18


Many time, cbot disconnect to the Internet or crash (no reson). How can I keep the value of variable in the cbot after cbot restart?


@baolinhhk6
Replies

firemyst
11 Sep 2023, 18:21

When an exception happens, write out the values of any variables you want to a text file; then next time you start your bot, read the values in from the text file if it exists.

the text file can be saved as JSON data, CSV, or any other formats that you want to work with.


@firemyst