change a stop loss while it was disconnected
change a stop loss while it was disconnected
01 Dec 2021, 09:30
My cBot add an error running live yesterday. When I looked at the logs it seems it tried to change a stop loss while it was disconnected.
I'm not sure how can that be but how can I prevent such a think from happening?
Thanks
Replies
eynt
01 Dec 2021, 13:58
RE: RE: RE: RE: RE:
Please view the "DISCONNECTED" errors I got below. I can upload the entire logf but i'm not sure how to upload files to the forum.
They happened during a simple 'ModifyStopLossPrice' which always works fine, including on the day of the errors, until the errors occured.
2021.11.30 16:02:17.920 | Request to amend position PID64902077 (SL: 1.49319) is sent to server
2021.11.30 16:02:19.186 | Request to amend position PID64919920 (SL: 1577.54) is sent to server
2021.11.30 16:02:21.202 | Request to Buy 0.01 Lots SpotCrude is sent to server
2021.11.30 16:02:22.137 | → Request to amend position PID64902077 (SL: 1.49319) is REJECTED with error "DISCONNECTED"
2021.11.30 16:02:22.146 | → Request to amend position PID64919920 (SL: 1577.54) is REJECTED with error "DISCONNECTED"
2021.11.30 16:02:22.211 | → Order OID0 is REJECTED with error "DISCONNECTED"
2021.11.30 16:02:22.315 | Request to close position PID64902077 is sent to server
2021.11.30 16:02:22.362 | → Failed to close position PID64902077 with error "DISCONNECTED"
2021.11.30 16:02:22.365 | Request to close position PID64919920 is sent to server
2021.11.30 16:02:22.376 | → Failed to close position PID64919920 with error "DISCONNECTED"
2021.11.30 16:02:23.651 | cBot "Main" was stopped for SpotCrude, Ra1.
2021.11.30 16:02:28.941 | Request to close position PID64902077 is sent to server
2021.11.30 16:02:29.109 | → Request to close position PID64902077 is ACCEPTED, order OID101746508 created (30/11/2021 16:02:29.028 UTC+0)
2021.11.30 16:02:29.420 | → Order OID101746508 is FILLED at 1.48182, position PID64902077 closed (30/11/2021 16:02:29.059 UTC+0)
2021.11.30 16:02:29.597 | cBot "Main" was stopped for CHFSGD, Ra1.
2021.11.30 16:12:40.758 | cBot "Main" was stopped for XAUEUR, Ra1.
2021.11.30 16:38:17.105 | cTrader started
@eynt
amusleh
02 Dec 2021, 08:45
RE: RE: RE: RE: RE: RE:
yuval.ein said:
Please view the "DISCONNECTED" errors I got below. I can upload the entire logf but i'm not sure how to upload files to the forum.
They happened during a simple 'ModifyStopLossPrice' which always works fine, including on the day of the errors, until the errors occured.
2021.11.30 16:02:17.920 | Request to amend position PID64902077 (SL: 1.49319) is sent to server
2021.11.30 16:02:19.186 | Request to amend position PID64919920 (SL: 1577.54) is sent to server
2021.11.30 16:02:21.202 | Request to Buy 0.01 Lots SpotCrude is sent to server
2021.11.30 16:02:22.137 | → Request to amend position PID64902077 (SL: 1.49319) is REJECTED with error "DISCONNECTED"
2021.11.30 16:02:22.146 | → Request to amend position PID64919920 (SL: 1577.54) is REJECTED with error "DISCONNECTED"
2021.11.30 16:02:22.211 | → Order OID0 is REJECTED with error "DISCONNECTED"
2021.11.30 16:02:22.315 | Request to close position PID64902077 is sent to server
2021.11.30 16:02:22.362 | → Failed to close position PID64902077 with error "DISCONNECTED"
2021.11.30 16:02:22.365 | Request to close position PID64919920 is sent to server
2021.11.30 16:02:22.376 | → Failed to close position PID64919920 with error "DISCONNECTED"
2021.11.30 16:02:23.651 | cBot "Main" was stopped for SpotCrude, Ra1.
2021.11.30 16:02:28.941 | Request to close position PID64902077 is sent to server
2021.11.30 16:02:29.109 | → Request to close position PID64902077 is ACCEPTED, order OID101746508 created (30/11/2021 16:02:29.028 UTC+0)
2021.11.30 16:02:29.420 | → Order OID101746508 is FILLED at 1.48182, position PID64902077 closed (30/11/2021 16:02:29.059 UTC+0)
2021.11.30 16:02:29.597 | cBot "Main" was stopped for CHFSGD, Ra1.
2021.11.30 16:12:40.758 | cBot "Main" was stopped for XAUEUR, Ra1.
2021.11.30 16:38:17.105 | cTrader started
Hi,
It looks like cTrader got disconnected while your cBot code was running, and all the code commands failed as cTrader was disconnected.
So you were already inside OnTick, it wasn't called after disconnection, it was called while cTrader was connected and while it was executing cTrader got disconnected.
@amusleh
amusleh
01 Dec 2021, 09:35
Hi,
Please check your other thread: cTDN Forum - a way to know when the app is disconnected and reconnected (ctrader.com)
@amusleh