cBot Crashes in Cloud when using the new "ProtectionType" parameter
cBot Crashes in Cloud when using the new "ProtectionType" parameter
09 Jan 2025, 05:31
Hi All,
I'm using cTrader 5.1.111 terminal.
A new parameter, ProtectionType, has been added to the function for placing and modifying orders with stop loss and take profit.
Following are the functions' signatures;
public TradeResult PlaceStopOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLoss, double? takeProfit, ProtectionType? protectionType)
public TradeResult ModifyPosition(Position position, double? stopLoss, double? takeProfit, ProtectionType? protectionType)
It is not clear to me what the new parameter does. As mentioned in the Help section, it has three fields; ProtectionType.None ProtectionType.Relative ProtectionType.Absolute
When the new parameter is used and the cBot runs in the terminal, there appear to be no issues.
However when the cBot runs in the cloud, it crashes logging the following error;
09/01/2025 04:10:22.119 Error | Crashed in OnStart with TypeLoadException: Could not load type 'cAlgo.API.ProtectionType' from assembly 'cAlgo.API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3499da3018340880'.
So at the moment, I'm using the function without the new parameter. The algorithm displays Warnings about the function being obsolete during the Build, but the cBot works fine both in the terminal and in the cloud.
Could anyone explain what the new parameter does and whether the cloud issue is solvable?
Replies
gzarruk
28 Mar 2025, 11:06
( Updated at: 28 Mar 2025, 11:08 )
same problem
I have the same issue. My bot outputs an error but keeps on running.
I left it with the ProtectionType parameter since removing it gives warnings.
I would be useful to get more documentation about ProtectionType and how to avoid the crash on the cloud instance.
@gzarruk
firemyst
28 Mar 2025, 12:13
RE: same problem
gzarruk said:
I have the same issue. My bot outputs an error but keeps on running.
I left it with the ProtectionType parameter since removing it gives warnings.
I would be useful to get more documentation about ProtectionType and how to avoid the crash on the cloud instance.
From playing around with it, this is what I gather on how it works:
- set it to “none” removes all protections
- set it to “relative” means the SL is in PIPs
- setting it to “absolutely” means the SL is a price.
I'm not sure if it affects the Take Profit as well.
@firemyst
firemyst
10 Jan 2025, 00:25 ( Updated at: 10 Jan 2025, 06:10 )
I've asked this earlier - wanting to know what the parameters do, and still waiting for a response as well:
https://community.ctrader.com/forum/cbot-support/46002/
@firemyst