DISCONNECTED Error

Created at 16 Nov 2021, 21:35
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!
HA

haohan51

Joined 12.01.2021

DISCONNECTED Error
16 Nov 2021, 21:35


Hello,

 

I sent an urgent email yesterday regarding DISCONNECTED errors I am getting when running my cAlgos. Please can I get a response to that? My body of the email is below with private information removed.

 

Dear cTrader,

 

Summary of issue

I have cTrader running on a VPS (ForexVPS.net). It is running multiple cAlgos that are actively opening new positions, and managing them on a regular 3 minute intervals. All orders and positions are being constantly modified (e.g. changing take profit) on a 3 minute interval.

But I am experiencing “DISCONNECT” error issues on a regular basis when I look at the Log. There are large periods of BLACKOUT where none of my positions are being managed by the algos.

The algos are managing a relatively high number of orders and positions. It will not be uncommon for there to be 100 orders and 50 positions on the account, all of which are being modified every 3 minutes by the algo. This is done by an “OnBar” event with a M3 chart loaded.

 

Examples & Evidence

I have provided a recent Log file in the attachment.

If you search for “DISCONNECTED” you will find countless examples of this.

For example:

2021.11.15 23:12:03.938 | → Request to amend position PID97577999 (TP: 0.92431) is ACCEPTED

2021.11.15 23:40:46.109 | Request to amend position PID97591760 (TP: 114.110) is sent to server

2021.11.15 23:40:46.143 | → Request to amend position PID97591760 (TP: 114.110) is REJECTED with error "DISCONNECTED"

2021.11.15 23:42:00.163 | Request to amend position PID97591722 (TP: 114.118) is sent to server

2021.11.15 23:42:00.178 | Request to amend position PID97591760 (TP: 114.120) is sent to server

In this example, I was not actively looking at the VPS until 23:40, at which point I logged in to check on the algo.

I noticed that there was a black out between 23:12 and 23:40 where there was no activity. BUT THERE SHOULD HAVE BEEN.

For some reason, only when I logged into the VPS (via RDP) did the algo seem to start again. It tried to modify positions at 23:40 after I logged into the VPS but failed with DISCONNECT.

It later tried again at 23:42 and succeeded.

So the order of events is:

  1. When I am not looking at the VPS, cTrader goes into black out where no orders/positions are amended but they should be (seemingly disconnected)
  2. When I log back into the VPS and click into cTrader, cTrader wakes up and tries to modify orders/positions again like it should
  3. First round of attempted order/position order modifications after I log back in FAIL with DISCONNECT. Which suggests it has been DISCONNECTED for a long time (between 23:12 and 23:40 in the example).
  4. From the second round of order/positions modifications (approx 3 minutes later), it works again.
  5. Repeat

 

VPS details

Provider: https://www.forexvps.net/

Account type: “Standard”

OS: Windows Server 2012

RAM: 4GB

CPU Cores: 2

Disc Space: 90GB

Internet speed test (Google):

Please can someone help me with this asap. This is putting massive risk to my trading and livelihood.

Kind regards,


@haohan51
Replies

PanagiotisCharalampous
17 Nov 2021, 07:56

Hi haohan51,

There is no gerenal issue with our connectivity at the moment so probably the issue is on your side. Some things you can check.

  1. Check your proxy latency. Try restarting cTrader so that it can connect to the best available proxy.
  2. Confirm that your VPS can execute your cBots efficiently. If the cBots consume much of the resources of the VPS, disconnections might happen.
  3. Try running the cBot on a different machine, maybe your own PC, and check if you can reproduce the problem.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

 


@PanagiotisCharalampous

haohan51
17 Nov 2021, 20:21 ( Updated at: 21 Dec 2023, 09:22 )

RE:

Hello Panagiotis,

Thank you for your reply.

I have noted that during the period of mass position/order modification (that happens every 3 minutes), both the CPU cores of the two core VPS goes extremely high in usage, around 99% for moments. You can see this in the screenshot below.

Is this likely the underlying issue?

If so, are you able to make any suggestions?

The code at the moment uses the "Async" method to operate, such as "ModifyPendingOrderAsync" and "ModifyPositionAsync". Does this add extra workload onto the CPU because it's trying to do everything in parallel? Would using non-Async method reduce the CPU load?

Thank you,

 

Circled in red are the times when positions/orders are being modified (happens every 3 mins).


@haohan51

PanagiotisCharalampous
18 Nov 2021, 09:02

Hi haohan51,

Is this likely the underlying issue?

It's a probable cause

If so, are you able to make any suggestions?

Either get a VPS with higher specs or optimize your code

The code at the moment uses the "Async" method to operate, such as "ModifyPendingOrderAsync" and "ModifyPositionAsync". Does this add extra workload onto the CPU because it's trying to do everything in parallel? Would using non-Async method reduce the CPU load?

It could decrease the CPU load but it will make execution slower. If your trading decisions are time critical, then opt for a VPS with more cores.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

haohan51
19 Nov 2021, 02:35

RE:

Thank you Panagiotis. I will look to explore these areas.

 


@haohan51

haohan51
19 Nov 2021, 12:10 ( Updated at: 21 Dec 2023, 09:22 )

RE:

I managed to catch the incident in the screen shot below.

You can see that:

1. the program is "Not Responding"

2. It is "Reconnecting", suggesting that it is currently disconnected

 

Does this form of manifestation offer you any clues as to the root of the problem?

Also, are there any diagnostic data for this type of "Not Responding" error that one could look at?

Than you


@haohan51

PanagiotisCharalampous
19 Nov 2021, 12:21

Hi haohan51,

You can send us some troubleshooting info when this happens (Ctrl+Alt+Shift+T). However I am 99% sure this is happening because of your cBot.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

haohan51
19 Nov 2021, 14:30 ( Updated at: 21 Dec 2023, 09:22 )

RE:

I am not sure it is due to cBot, because I've just had the "not responding" issue when there I had no cBots running at all. Please see screenshot below.

Only difference was that this time it didn't say "Reconnecting". However, it still wasn't displaying the "Live * [Account] * Hedging * £XXX * Leverage" that is usually there if connected properly - suggesting perhaps the connection wasn't correct.

I also opened task manager during this event and you can see CPU usage was not high at all.

The "not responding" period lasted at least 2 minutes, before cTrader finally became responsive again.

As such, I think it is worth investigating on your side?

 

I have tried to send reports before via Ctrl+Alt+Shift+T, but I have never had a response. How can I send a report and:

1. Link it to this post so you know who it's from

2. Make sure to get a response either on here or via email after submitting using Ctrl+Alt+Shift+T

 

Thank you

 


@haohan51

haohan51
19 Nov 2021, 14:43 ( Updated at: 21 Dec 2023, 09:22 )

RE: RE:

An even better example just now, as it is "not responding" and "reconnecting" while no cBots were running and CPU usage was low.

 


@haohan51

PanagiotisCharalampous
19 Nov 2021, 14:45 ( Updated at: 21 Dec 2023, 09:22 )

Hi haohan51,

Send it like this

Also make sure there are no indicators/cBots running in cTrader Automate

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

haohan51
20 Nov 2021, 01:35 ( Updated at: 21 Dec 2023, 09:22 )

RE:

Hello,

I have submitted the report (see screenshot below). Please could you get back to me on here, that would be greatly appreciated.

Thanks a lot

 


@haohan51

webkinson
09 Nov 2023, 10:46 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE:





Hi Guys,

 

I am replying to this thread as seems relevant to handling certain error messages when closing a position. The DISCONNECTED error happens when obviously there is network communication error. 

I am trying to fix this using a try/catch… I will do more tests - how to catch this error … I think I need to change my TRY/CATCH a bit

 

 

 

 

 

 

 

 

Edit: I think the code need to be amended to use TradeResult .

 


@webkinson