Need of Sequential Execution of cBot - Multithreading issue

Created at 30 Jan 2014, 15:33
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!
JO

jobenb

Joined 07.10.2013

Need of Sequential Execution of cBot - Multithreading issue
30 Jan 2014, 15:33


Hi

I need my cBot to execute sequentially and one thread at a time - not to be pampered with multiple threads all at once, so making it thread safe by introducing a sync lock does the trick, however pressing stop after the cBot has run 3/4 of the back test makes cAlgo hang. This is possibly because every tick is executed in a different thread which is locked up and needs to wait forming a bottleneck at the lock. cAlgo now possibly waits for all threads to be completed and bang it hangs. Not acceptable and very irritating.

I know I might be wrong in my assumption, but please could you test some cAlgos with locking that is back testing on 1 minute all available history?

Please could you rectify or advise?

Many thanks!! :-)

  


@jobenb
Replies

Spotware
30 Jan 2014, 17:15

The cAlgo API is not multi-threading and you do not need to synchronize anything. 
Multi-threading issues could possibly be happening if you are using the Timer class because then that would be invoked in a separate thread. We do not recommend the usage of the Timer class since the cAlgo API is not thread-safe.
The cAlgo API should not be accessed by multiple threads.


@Spotware