Backtesting in .NET 6 not working. .NET4 works

Created at 13 Nov 2022, 08:59
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!
CT

ctid3999979

Joined 05.07.2021

Backtesting in .NET 6 not working. .NET4 works
13 Nov 2022, 08:59


Hi

When I create a bot in cTrader (4.4.19) and I set up a back test, it seems to just skip the back test, even if the Visual Mode is enabled. Example in the video below.

Example Behaviour


@ctid3999979
Replies

Spotware
14 Nov 2022, 10:37

Dear trader,

Thank you for reporting this issue. Unfortunately we were not able to reproduce this behavior. Could you please send us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.

Best regards,

cTrader Team


@Spotware

Spotware
25 Nov 2022, 14:39

Dear trader,

Unfortunately the troubleshooting did not help us reproducing this behavior. Does this still happen in 4.5.1? If yes, can you send us the log?

Best regards,

cTrader Team


@Spotware

ctid3999979
25 Nov 2022, 14:49

RE:

Spotware said:

Dear trader,

Unfortunately the troubleshooting did not help us reproducing this behavior. Does this still happen in 4.5.1? If yes, can you send us the log?

Best regards,

cTrader Team

Hi

Thanks for following up. I submitted a support request via cTrader yesterday which has a link to this thread in it. However, to clarify here, I've updated to 4.5.1 and am still getting the same results.

I even wiped my hard drive and installed a fresh copy of Windows 11, along with everything else and still the same problem.

Sorry if I'm being ignorant but are you referring to the log tab of the backtest? If so, these are the only two entries.

24/10/2022 00:00:00.000 | CBot instance [New cBot, EURUSD, h1] started.
24/10/2022 00:00:00.000 | CBot instance [New cBot, EURUSD, h1] process was unexpectedly terminated.
 

That is from a newly created bot without any changes made to it at all.


@ctid3999979

ctid3999979
08 Dec 2022, 21:47

RE: RE:

 

Hi

I'm guessing you still haven't been able to replicate this? I re-imaged my laptop again this weekend and it's still happening.


@ctid3999979

Spotware
09 Dec 2022, 11:03

Dear trader,

Our team would like to arrange a TeamViewer session to investigate the issue locally. If it is possible for us to get access to your computer, please contact us on Telegram (@cTrader_Team) or at community@ctrader.com

Best regards,

cTrader Team


@Spotware

marshallmeno
11 Dec 2022, 00:24

I also have the same problem

Hello, I also have the exact same problem. Only .net 4 (legacy) can work with backtesting but not .net 6....I had reinstalled Windows 11 and still same problem. What was the fix for that?

Thanks, appreciate your help!


@marshallmeno

ctid3999979
11 Dec 2022, 13:48

RE: I also have the same problem

marshallmeno said:

Hello, I also have the exact same problem. Only .net 4 (legacy) can work with backtesting but not .net 6....I had reinstalled Windows 11 and still same problem. What was the fix for that?

Thanks, appreciate your help!

I've not got a solution yet. I've spent my entire weekend trying to find a fix.

I've reinstalled Windows 11 again this yesterday and it's the same problem. I've also created Hyper-V VMs with Windows 10 Ent, Edu & Pro, as well as Windows 11 Ent, Edu & Pro. Each time both .NET6 and .NET4 bots and indicators work fine in all the Windows 10 VMs, but only the .NET4 bots and indicators work in all the Windows 11 VMs. You can probably appreciate the considerable time out of my weekend that this has taken.

I've contacted Spotware via Telegram, but they probably won't pick it up until tomorrow.

I can only assume, at the moment, that Spotware don't support Windows 11 for cTrader, which needs to be corrected pretty promptly, as a high priority, as all new Windows computers now come with Windows 11 and it is 14 month old OS, especially as it's a Windows only client.


@ctid3999979

marshallmeno
11 Dec 2022, 15:34

RE: RE: I also have the same problem

ctid3999979 said:

marshallmeno said:

Hello, I also have the exact same problem. Only .net 4 (legacy) can work with backtesting but not .net 6....I had reinstalled Windows 11 and still same problem. What was the fix for that?

Thanks, appreciate your help!

I've not got a solution yet. I've spent my entire weekend trying to find a fix.

I've reinstalled Windows 11 again this yesterday and it's the same problem. I've also created Hyper-V VMs with Windows 10 Ent, Edu & Pro, as well as Windows 11 Ent, Edu & Pro. Each time both .NET6 and .NET4 bots and indicators work fine in all the Windows 10 VMs, but only the .NET4 bots and indicators work in all the Windows 11 VMs. You can probably appreciate the considerable time out of my weekend that this has taken.

I've contacted Spotware via Telegram, but they probably won't pick it up until tomorrow.

I can only assume, at the moment, that Spotware don't support Windows 11 for cTrader, which needs to be corrected pretty promptly, as a high priority, as all new Windows computers now come with Windows 11 and it is 14 month old OS, especially as it's a Windows only client.

I have another device "Microsoft Surface Go3" with Windows 11 and cTrader works there perfectly with .Net 6. Weird.


@marshallmeno

ctid3999979
11 Dec 2022, 16:12

RE: RE: RE: I also have the same problem

marshallmeno said:

ctid3999979 said:

marshallmeno said:

Hello, I also have the exact same problem. Only .net 4 (legacy) can work with backtesting but not .net 6....I had reinstalled Windows 11 and still same problem. What was the fix for that?

Thanks, appreciate your help!

I've not got a solution yet. I've spent my entire weekend trying to find a fix.

I've reinstalled Windows 11 again this yesterday and it's the same problem. I've also created Hyper-V VMs with Windows 10 Ent, Edu & Pro, as well as Windows 11 Ent, Edu & Pro. Each time both .NET6 and .NET4 bots and indicators work fine in all the Windows 10 VMs, but only the .NET4 bots and indicators work in all the Windows 11 VMs. You can probably appreciate the considerable time out of my weekend that this has taken.

I've contacted Spotware via Telegram, but they probably won't pick it up until tomorrow.

I can only assume, at the moment, that Spotware don't support Windows 11 for cTrader, which needs to be corrected pretty promptly, as a high priority, as all new Windows computers now come with Windows 11 and it is 14 month old OS, especially as it's a Windows only client.

I have another device "Microsoft Surface Go3" with Windows 11 and cTrader works there perfectly with .Net 6. Weird.

What edition of Windows 11 does your Surface Go have? I have a Surface Pro 8 and I have the Education edition. It's the same as the Enterprise but with out App-V I believe


@ctid3999979

ctid3999979
11 Dec 2022, 16:18

RE: RE: RE: RE: I also have the same problem

 

I've now just created a VM in Azure using the Windows 11 Ent 22H2 image provided by MS. Same problem.


@ctid3999979

ctid3999979
11 Dec 2022, 17:01

RE: RE: RE: RE: RE: I also have the same problem

Just did a test on a Win 11 Home Edition VM and the exact same problem


@ctid3999979

ctid3999979
11 Dec 2022, 17:20 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE: RE: RE: RE: RE: I also have the same problem

Gets more interesting

If you debug the bot, changing the AccessRights to FullAccess, after running it and you get the Available Debuggers window, click Cancel and the bot will run. Change AccessRights back to the Default of None, and it crashes.

 


@ctid3999979

marshallmeno
13 Dec 2022, 22:33

RE: RE: RE: RE: I also have the same problem

ctid3999979 said:

marshallmeno said:

ctid3999979 said:

marshallmeno said:

Hello, I also have the exact same problem. Only .net 4 (legacy) can work with backtesting but not .net 6....I had reinstalled Windows 11 and still same problem. What was the fix for that?

Thanks, appreciate your help!

I've not got a solution yet. I've spent my entire weekend trying to find a fix.

I've reinstalled Windows 11 again this yesterday and it's the same problem. I've also created Hyper-V VMs with Windows 10 Ent, Edu & Pro, as well as Windows 11 Ent, Edu & Pro. Each time both .NET6 and .NET4 bots and indicators work fine in all the Windows 10 VMs, but only the .NET4 bots and indicators work in all the Windows 11 VMs. You can probably appreciate the considerable time out of my weekend that this has taken.

I've contacted Spotware via Telegram, but they probably won't pick it up until tomorrow.

I can only assume, at the moment, that Spotware don't support Windows 11 for cTrader, which needs to be corrected pretty promptly, as a high priority, as all new Windows computers now come with Windows 11 and it is 14 month old OS, especially as it's a Windows only client.

I have another device "Microsoft Surface Go3" with Windows 11 and cTrader works there perfectly with .Net 6. Weird.

What edition of Windows 11 does your Surface Go have? I have a Surface Pro 8 and I have the Education edition. It's the same as the Enterprise but with out App-V I believe

Mine is Windows 11 Home.


@marshallmeno

deeganpope
16 Feb 2023, 08:21

RE: Same issue of backtest and optimization not starting on brand new win11 build

Spotware said:

Dear trader,

Unfortunately the troubleshooting did not help us reproducing this behavior. Does this still happen in 4.5.1? If yes, can you send us the log?

Best regards,

cTrader Team

 

I just built a brand new machine tonight.  Loaded windows 11 and then ctrader.  I imported by bots and indicators.   They build, but they do nothing.

If you press the play button it acts like its going to run the backtest but does not.  Optimization loads threads but never does anything either.

 

System is Ryzen 9 7900X w 32GB DDR5, 2TB NVME, windows 11 pro.


@deeganpope

Spotware
16 Feb 2023, 09:25

Dear deeganpope,

Which version of cTrader do you use?

Best regards,

cTrader Team


@Spotware

don.schriefer
06 Mar 2023, 17:17

RE: Same Issue

Hi there,

ever since I installed Windows 11 this has been happening to me. I've had to use .NET 4 for backtesting.

OS: Windows 11 Pro 22H2 (Build: 22621.1265)
cTrader Version: 4.5.9.13513 (ICMarkets)

Using the following code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class SimpleTrader : Robot
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        protected override void OnStart()
        {
            Print("Hello world");
        }

        protected override void OnTick()
        {
            
        }

        protected override void OnStop()
        {
            
        }
    }
}

My output in the console is:

05/02/2023 01:00:00.000 | Indicator instance [Bollinger Bands, EURUSD, Hh4] unloaded.
05/02/2023 01:00:00.000 | Indicator instance [Aroon, EURUSD, Hh4] unloaded.
05/02/2023 01:00:00.000 | Indicator instance [MACD Crossover, EURUSD, Hh4] unloaded.
05/02/2023 01:00:00.000 | Indicator instance [Chaikin Money Flow, EURUSD, Hh4] unloaded.
05/02/2023 01:00:00.000 | CBot instance [SimpleTrader, EURUSD, Hh4] started.
05/02/2023 01:00:00.000 | Indicator instance [Chaikin Money Flow, EURUSD, Hh4] loaded.
05/02/2023 01:00:00.000 | Indicator instance [MACD Crossover, EURUSD, Hh4] loaded.
05/02/2023 01:00:00.000 | Indicator instance [Aroon, EURUSD, Hh4] loaded.
05/02/2023 01:00:00.000 | Indicator instance [Bollinger Bands, EURUSD, Hh4] loaded.
05/02/2023 01:00:00.000 | CBot instance [SimpleTrader, EURUSD, Hh4] process was unexpectedly terminated.

I have tried everything, but could not get it to work on Windows 11. I have just resorted to compiling in .NET 4, and that still works.

Hoping this issue gets some more attention, glad to see I'm not the only one struggling with this.

Cheers


@don.schriefer

PanagiotisChar
07 Mar 2023, 16:10

Hi Don,

Does your cBot reference any indicators?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar

don.schriefer
07 Mar 2023, 16:51

RE:

PanagiotisChar said:

Hi Don,

Does your cBot reference any indicators?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

 

Hi Panagiotis,

thanks for the reply. No, in an attempt to have a simple "Hello World" program, there are no custom indicators.

The indicator instances in the log are because I had them open on the backtesting chart. Even if I have a clean chart without any indicators on, the cBot process terminates unexpectedly on runtime. Is there a way to provide a detailed log output of what is happening in the background to debug?


@don.schriefer

PanagiotisChar
08 Mar 2023, 09:22

Hi Don,

Which cTrader version do you use? Did you try using the latest one (4.6.4)?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us


@PanagiotisChar

don.schriefer
08 Mar 2023, 09:42 ( Updated at: 21 Dec 2023, 09:23 )

RE:

PanagiotisChar said:

Hi Don,

Which cTrader version do you use? Did you try using the latest one (4.6.4)?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Hi Panagiotis,

I am using cTrader version 4.6.4.13909 and I have installed the .NET SDK and set to use it in cTrader's settings.



The following code produces the "process terminated unexpectedly" error:


Thanks for the reply, hope that we can find a solution for this.


@don.schriefer

don.schriefer
03 Apr 2023, 19:44

RE: Found a Solution [Workaround]

PanagiotisChar said:

Hi Don,

Which cTrader version do you use? Did you try using the latest one (4.6.4)?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Hi there Panagiotis,

since there hasn't been much activity on this thread, I just wanted to post a workaround that I discovered whilst searching the forums.

If I set the AccessRights to Full in the cBot, the error is gone and I can compile and run bots using Automate. Hope it helps anyone else that is struggling with this issue.

Cheers,

Don


@don.schriefer

ariel.romero.trading
19 Sep 2023, 02:26 ( Updated at: 19 Sep 2023, 04:44 )

RE: RE: Found a Solution [Workaround]

don.schriefer said: 

PanagiotisChar said:

Hi Don,

Which cTrader version do you use? Did you try using the latest one (4.6.4)?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

Hi there Panagiotis,

since there hasn't been much activity on this thread, I just wanted to post a workaround that I discovered whilst searching the forums.

If I set the AccessRights to Full in the cBot, the error is gone and I can compile and run bots using Automate. Hope it helps anyone else that is struggling with this issue.

Cheers,

Don

Thanks Don!  I've been dealing with this almost a month, installing and uninstalling .Net versions with no solution.

This was the only thing that worked!! Now what would the thing that changes from the 4.x that make it works with that change uh?

Thanks again!!


@ariel.romero.trading