incorrect API documention for error codes
incorrect API documention for error codes
21 Jan 2020, 10:33
Both cTrader Automate 3.6 and https://ctrader.com/api/reference/errorcode give an example that the "build" command of cTrader Automate 3.6 rejects with an error.
The example:
protected override void OnError(Error error) { // Print the error to the log switch (error.Code) { case ErrorCode.BadVolume: Print("Bad Volume"); break; case ErrorCode.TechnicalError:Print("Technical Error"); break; case ErrorCode.NoMoney: Print("No Money"); break; case ErrorCode.Disconnected: Print("Disconnected"); break; case ErrorCode.MarketClosed: Print("Market Closed"); break; } }
gives this error:
Error CS0115: 'cAlgo.Robots.ScalperBot.OnStop(cAlgo.API.ErrorCode)': no suitable method found to override
The cursor sits immediately in front of the OnError token: protected override void |OnError(Error error)
Replies
snowchilli
21 Jan 2020, 11:10
RE:
Apologies - I had pasted the code into an OnStop function instead of an OnError function.
Thank you for your swift reply.
@snowchilli
PanagiotisCharalampous
21 Jan 2020, 10:40
Hi snowchilli,
Based on the error code, you are using a wrong method name
You have pasted the OnError() method code but it seems your actual method is called OnStop(). If you paste your complete cBot code, we can check and fix this for you.
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous