Lag issues when running cBots on cTrader
Lag issues when running cBots on cTrader
11 Jul 2019, 09:56
I have encountered some lag/freeze issues when running cBots on the cTrader (desktop) platform, so I'm looking to see if there is any way I can remedy this.
About the bots:
At most hours of the day, I have somewhere between 12 and 30 bots running, each monitoring one currency pair/symbol. They are small and simple bots, whose only task is to check the size of the freshly drawn candles on the 5-minute charts (so they only do calculations every 5 minutes, there is no "OnTick" part in the programming, only "OnBar" ) and then give me notice when the candle size exceeds a certain number.
About the notice that he bots give, since i have been informed there is no way to make the bots create pop-ups ala cTrader's price alerts (which would be a feature I would really like to have), I have programmed a work-around that sends buy orders I know will be rejected due to bad parameters, since that creates pop-ups saying the orders have been rejected.
Where the problem shows up:
99% of the time this works very well, but at certain times where many of the bots send notices (aka buy orders) at once (like during fed rate decisions, NFPs, etc.) the platform lags/freezes.
Also the platform runs markedly slower after having been running for a few days straight, but restarting the platform means quite a bit of work restarting the bots, so it's something I'd rather not due. In the web version, this is fixed simply by clearing cache/cookies..
My questions:
What can I do to minimize the mentioned lag/freeze/slowness issues? Will a more powerful computer help? Will spreading the bots over more than one computer and/or trading account be a good idea? Will there be any difference between using wireless and cabled internet? Is there a way to "refresh" the cTrader (desktop) platform without having to restart and thus turn off the bots?
Replies
wefald
11 Jul 2019, 10:43
Thanks for replying fast.
I don't have a name regarding who told me this, but someone did. Either from the FxPro support team or from Spotware, as I was learning how to program cBots.
(Since I was told I could not make a pop-up window at all, I think my solution is rather creative. But yeah, bottlenecking during busy times when trying to send a bunch of orders shouldn't come as a big surprise to anyone.)
I tried the code you just provided, but I got an error saying that the type or namespace name Forms does not exist in namespace System.Windows (Maybe you miss a "samlingsreferanse"?)
(The error message was in Norwegian, but the last word translates word for word to collection referance)
@wefald
PanagiotisCharalampous
11 Jul 2019, 10:50
( Updated at: 21 Dec 2023, 09:21 )
Hi wefaid,
You need to add a reference to System.Windows.Forms. See below
Best Regards,
Panagiotis
@PanagiotisCharalampous
wefald
11 Jul 2019, 11:06
It worked. Thanks!
Is it also possible to make this pop-up make a sound of some kind? The "pop" sound of a rejected buy order is a big part of why I chose that solution.
A search for "messagebox" in the cBot API I have yielded zero results.
If sound is not doable, then do you have similar code for an email alert? I could have an alert sent to some account that i equipped with desktop notifications.
@wefald
PanagiotisCharalampous
17 Jul 2019, 11:19
Hi wefaid,
You can use Notifications class for both sound and email alerts.
Best Regards,
Panagiotis
@PanagiotisCharalampous
alexsanramon
26 Jul 2019, 04:37
Dear Panagiotis,
I also have this issue even though I have switched to onBar. Please explain in details what bottlenecks to expect so that I can manage it.
Thanks in advance.
Alexis
@alexsanramon
PanagiotisCharalampous
11 Jul 2019, 10:12
Ηι wefald,
Thank you for posting in our forum.
Who told you this? Of course you can create pop ups using cBots. e.g.
With the way you have chosen to handle this, I would expect bottlenecks. Try converting your cBot to use pop ups or email alerts and let us know if the performance is improved.
Best Regards,
Panagiotis
@PanagiotisCharalampous