Read/Write counter values

Created at 15 Jun 2020, 16:02
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!
SE

SEOCO

Joined 23.05.2020

Read/Write counter values
15 Jun 2020, 16:02


Hi,

I have written my fist bot but still I am struggle to have everything working as I would like.

The most disadvantage part of cTrader and cAlgo is that you have to run it on a Windows environment. This is very old fashion.

My script is rnow unning on a Windows Server 2019 Virtual Server on Azure Cloud and the problem I am facing now is that the server needs to reboot from time to time because of software updates or other Windows shit.

In my script I am using a buy and sell counter. Based on those counters I make my next buy and sell.

Now when the server reboots and I need to restart my instances I am loosing my counter values.

Is there a way to store my counter values somehow every time they changing and read them back into my instances at startup ?

I have played around with StreamWriter & StreamReader but every time I want to update my counter it add a new line.

Is there no way to work with a settings file or something?

Any idea how to solve this?

Thanks,

Mario


@SEOCO
Replies

PanagiotisCharalampous
15 Jun 2020, 16:08

Hi Mario,

You can just override the file every time you are writing a new value. You can use File.WriteAllText() to do so.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous