How do I specify the name of a new custom indicator, [Indicator("name here", ...] says it's obsolete?

Created at 01 Nov 2022, 00:08
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!
MA

martins

Joined 22.10.2019

How do I specify the name of a new custom indicator, [Indicator("name here", ...] says it's obsolete?
01 Nov 2022, 00:08


Returning to cBot/Indicator coding after a year away, everything seems to have changed!

Problem statement: In cTrader Desktop 4.2.22.8457, Automate -> New brings up a template for a new custom indicator, for instance
...
    [Indicator(AccessRights = AccessRights.None)]
    public class NewIndicator8 : Indicator

...
My question is how to set the name of this new indicator, since changing the name of the class before Build still creates it as NewIndicator8 (and the next one will be 9) - there seems to be no control over the name. Documentation says use [Indicator("Name goes here", ...] but that seems to be ignored with message: 
Warning CS0612 'IndicatorAttribute.IndicatorAttribute(string)' is obsolete ... in cAlgo\Sources\Indicators\New Indicator (8).cs
- as if the Build has already created the folder with its chosen name already. Doing Save before build didn't seem to make a difference, I thought perhaps it would use the name currently in the box preceding the New button, either when clicking New, or Save, but that made no difference, still came out as New Indicator <next number>.

Surely we're not supposed to have to rename the folder & source afterwards?! How do I set the name from within cTrader?


Also, the corresponding Build within Visual Studio 2022 (after clicking cTrader's 'Edit in Visual Studio' with the .NET Framework option left as default 6.0) gave error message saying "assets file '...projects.assets.json' was not found Run a NuGet package restore to generate this file" - doing that (Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution, then Install-Package cTrader.Automate in the PM console) shows it wanted to install cTrader.Automate 1.00 or 1.0.4 - the VS Build of NewIndicator8 then worked (...\New Indicator (9).algo === Rebuild All: 1 succeeded, 0 failed, 0 skipped ===). Later I created another New indicator, .NET 6.0, clicked Edit in Visual Studio, (VS2022 starts), click Build/Rebuild, and it had the same missing asset problem, as if cTrader.Automate is needed separately for every build solution - this doesn't seem right.  
 
Is there online documentation for converting old cBots & Indicators or saying this is required - might this help my other problem (forum item Visual Studio 2019 Build hangs on windows 10" ?)
Builds in VS used to "just work" once solutions & projects had been set up, but old stuff seems broken now by these new requirements - help or doc required please!

Is there an article explaining what's changed between cAlgo and cTrader Automate (as documented at, for instance, //ctrader.com/api/reference/robot and //help.ctrader.com/ctrader-automate/references/General/Robot/), how compatible are the methods & properties, and how the change affects building of old Visual Studio solutions - for instance does a build on 4.2.x always use Automate not cAlgo but works because all cAlgo methods & properties are a subset of ones in Automate if .NET 4 is specified, or something?? What needs to be done in (& using what version of) Visual Studio to migrate an existing bot or indicator solution to .NET 6?

(Note I have a separate forum item asking how to migrate cAlgo Visual Studio 2019 building from a year ago on Win 7 to VS 2019 or 2022 with cTrader 4.2.22 on Win 10)


@martins
Replies

PanagiotisChar
01 Nov 2022, 08:17

Hi martins,

If you want to rename the indicator, just right click on it and choose Rename. 

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar