Weird error when optimising

Created at 11 Mar 2023, 16:47
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!
JA

jaydcrowe1989

Joined 11.08.2022

Weird error when optimising
11 Mar 2023, 16:47


Hi,

Has anyone come across this error when running a bot in the optimisation process? 

02/01/2020 06:00:15.067 | Unable to invoke target method in current thread. Use `BeginInvokeOnMainThread` method to prevent this error.

 

I only seem to get this error when trying to run the bot in the optimsation process. I have wrapped everything in a try catch and do not seem to be capturing any errors, which is confusing?

 

Cheers,

Jay


@jaydcrowe1989
Replies

PanagiotisChar
13 Mar 2023, 15:33

Hi Jay,

This is a common C# exception that occurs when you are trying to access methods from different threads. During optimization, cTrader runs the cBot's dll in a separate thread, therefore this happens. The error also describes the solution to this issue.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar