How to deal with bots making cTrader unresponsive?
How to deal with bots making cTrader unresponsive?
14 Jan 2022, 15:05
I wrote a cAlgo bot
It works fine but after a while of running (sometimes hours), cTrader becomes very unresponsive.
I also run 2 instances of the bots on the same symbol.. one for long and one for short position management.
What would generally cause cTrader to hang or become unresponsive?
I have no idea where to start with debugging this.
The bot manages an existing (i.e. manually opened by the user) trade position. It doesn't do anything fancy like call other dlls or anything.
Do I need to put some kind of sleep statements in my code?
Any insight appreciated.
Replies
amusleh
17 Jan 2022, 09:34
RE:
ycomp said:
I wrote a cAlgo bot
It works fine but after a while of running (sometimes hours), cTrader becomes very unresponsive.
I also run 2 instances of the bots on the same symbol.. one for long and one for short position management.
What would generally cause cTrader to hang or become unresponsive?
I have no idea where to start with debugging this.
The bot manages an existing (i.e. manually opened by the user) trade position. It doesn't do anything fancy like call other dlls or anything.
Do I need to put some kind of sleep statements in my code?
Any insight appreciated.
Hi,
Your cBot is not coded properly, and there is only one solution, fix your cBot code.
@amusleh
ycomp
17 Jan 2022, 15:32
( Updated at: 17 Jan 2022, 15:35 )
RE: RE:
any tips though? I have disabled print statements as firemyst suggested, because it does produce some print statements on a regular basis. But any ideas what can cause this kind of problem?
My bot does nothing fancy except it does modify the order often.
So just to verify, there would be no benefit to adding Thread Sleep statements?
Also there is nothing wrong with having 2 isntances of the same bot running on the same symbol, correct? They never actually modify the same position. One modifies when positions are long, the other when short.. to change this behaviour would take a lot of work.
amusleh said:
ycomp said:
I wrote a cAlgo bot
It works fine but after a while of running (sometimes hours), cTrader becomes very unresponsive.
I also run 2 instances of the bots on the same symbol.. one for long and one for short position management.
What would generally cause cTrader to hang or become unresponsive?
I have no idea where to start with debugging this.
The bot manages an existing (i.e. manually opened by the user) trade position. It doesn't do anything fancy like call other dlls or anything.
Do I need to put some kind of sleep statements in my code?
Any insight appreciated.
Hi,
Your cBot is not coded properly, and there is only one solution, fix your cBot code.
@ycomp
firemyst
17 Jan 2022, 15:47
You have yet to mention the specs of the machine or VPS that you're running your cTrader on.
We also have no idea what your bot is doing. What people say vs what code actually does is two different things. For all we know, you could have a massive loop in there somewhere.
Also there is nothing wrong with having 2 isntances of the same bot running on the same symbol, correct?
Correct.
@firemyst
amusleh
18 Jan 2022, 09:17
RE: RE: RE:
ycomp said:
any tips though? I have disabled print statements as firemyst suggested, because it does produce some print statements on a regular basis. But any ideas what can cause this kind of problem?
My bot does nothing fancy except it does modify the order often.
So just to verify, there would be no benefit to adding Thread Sleep statements?
Also there is nothing wrong with having 2 isntances of the same bot running on the same symbol, correct? They never actually modify the same position. One modifies when positions are long, the other when short.. to change this behaviour would take a lot of work.
Hi,
It's almost impossible to help you unless you post the code of your cBot.
A lot of things can go wrong, and there will be no benefit at all if you add Thread sleep.
@amusleh
firemyst
14 Jan 2022, 17:04 ( Updated at: 21 Dec 2023, 09:22 )
HAve you monitored the computer's performance at all? Eg, how much, if at all, does memory usage go up? CPU usage?
In Windows Task Manager you can "tick" the cTrader process and see exactly how much memory and CPU it's using:
Does your bot or any indicators use a lot of "Print" statements that outputs to the logs? Those suck up lots of memory, which cannot be cleared except to close down cTrader and restart it.
@firemyst