Topics
04 Jan 2019, 14:08
 107
 6354
 18
Replies

riku.nortje@gmail.com
12 Apr 2023, 17:29

RE:

Hi. Thanks for the quick response.

 

Yes the FullAccess resolved the issue. Though why a simple indicator needs to be given full access rights seems problematic . Any reason for this?

 


@riku.nortje@gmail.com

riku.nortje@gmail.com
12 Apr 2023, 17:22

RE:

Further to the above and in case hardware my be a question

Processor: AMD Ryzen 5 5600X 6-Core Processor                3.70 GHz

Ram: 64,0 GB

Grahics NVidia GeForce RTX 360Ti

 

The rest I suppose is unimportant


@riku.nortje@gmail.com

riku.nortje@gmail.com
14 Apr 2022, 11:55

RE:

amusleh said:

Hi,

I tried to replicate the issue, but I was not able to.

The Positions and PendingOrders collections are derived from IEnumerable, and if your code is running a loop over them and they get modified it will cause an enumerable modified exception which is normal .NET behavior.

These collections aren't thread safe, actually Automate API in general is not thread safe, 

Please post a minimum cBot sample that can reproduce this issue.

And regarding creating a copy of Positions collections, use ToArray instead of ToList, as the later overhead is much larger than the former.

 

Thanks for looking into this. I will set up a simple bot to duplicate the issue and post it. Just to add some clarification, the issue occurred specifically during backtesting and most probably optimisation phases and not normal bot running. I initially noticed it when back testing in visual mode as the results after optimisation did not make sense. The bot is allowed to open multiple positions of the same type, but closes all positions of that type if it decides it is going to trade in the opposite direction. What happens is that after the loop above executed, some positions remained open which should not be the case, these then remained open, even if after some time the bot opened trades in the same direction again and then closed it. So it started having more and more of these loose hanging trades that never get closed. Using the tolist() solved the issue for me. Simple bot that this happens to to follow shortly    


@riku.nortje@gmail.com