Dot Net 6 indicators and bots not working
Dot Net 6 indicators and bots not working
12 Apr 2023, 17:10
Hi, I have been using cTrader with my own bots and indicators for a long while now, Since the second last update, 4.6.5 I have been having issues with compiling indicators or bots in dot net 6. I am only able to compile to legacy framework versions. In order to eliminate teh usual questions, I have done the following. I formatted my PC, keeping zero previous data, I physically deleted the partitions and recreated them. Installed a fresh copy of Windows 11 22H2 with the latest updates as of today. I then installed cTrader without any further software installations of any kind. So I have a clean PC, a fresh windows and only cTrader 4.7.7 installed. I open the automate tab, select the SampleSMA indicator that comes with the enw installation and compile to Dot Net 6. I used the embedded compiler as I have not installed anything else yet. The indicator compiles. But when I add it to any chart, it crashes after a few milliseconds and says the indicator thread closed unexpectedly. The exact message is
12/04/2023 15:55:31.296 | Indicator instance [Sample SMA, XAUUSD, m5] process was unexpectedly terminated.
The indicator code is the supplied sample code.
// -------------------------------------------------------------------------------------------------
//
// This code is a cTrader Automate API example.
//
// All changes to this file might be lost on the next application update.
// If you are going to modify this file please make a copy using the "Duplicate" command.
//
// -------------------------------------------------------------------------------------------------
using cAlgo.API;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
public class SampleSMA : Indicator
{
[Parameter("Source")]
public DataSeries Source { get; set; }
[Parameter(DefaultValue = 14)]
public int Periods { get; set; }
[Output("Main", LineColor = "Turquoise")]
public IndicatorDataSeries Result { get; set; }
public override void Calculate(int index)
{
var sum = 0.0;
for (var i = index - Periods + 1; i <= index; i++)
sum += Source[i];
Result[index] = sum / Periods;
}
}
}
I then installed the Net SDK 6.0.100 and set it as the compiler in the automate settings. Teh result is still successfull compilation but when the indicator is added to any chart, on its own with nothing else it gives the same error as above. Simply dies. I have tried it with creating a new indicator, the hello world blank tempalte:
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
{
[Indicator(AccessRights = AccessRights.None)]
public class NewIndicator : Indicator
{
[Parameter(DefaultValue = "Hello world!")]
public string Message { get; set; }
[Output("Main")]
public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
// To learn more about cTrader Automate visit our Help Center:
// https://help.ctrader.com/ctrader-automate
Print(Message);
}
public override void Calculate(int index)
{
// Calculate value at specified index
// Result[index] =
}
}
}
It compiles to Net 6, when added to any chart, it crashed with teh same error message.
The issue can only be a cTrader issue as this is a clean pc, with a clean install of cTrader, using a reference sample indicator. Please investigate
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