Robot Inheritance Problem

jobenb since: 07 Oct 2013;

  26 Jan 2014, 06:07
Robot Inheritance Problem

Hi

In cAlgo it does not pick up (show under new instance when added) the inherited public properties (market with Parameter attribute etc.) of my base robots when I reference it in another cAlgo robot.

Could you please release a new version with this bug fixed.

Thank you. 

Spotware's avatar

Spotware since: 23 Sep 2013;

  26 Jan 2014, 11:23

We do not have plans to support inheritance of Parameters from base class. As a workaround you can declare parameter in base class as virtual property and override it in the inherited class.

Base class:

    public class BaseCBot : Robot
    {
        [Parameter(DefaultValue = 10)]
        public virtual double Parameter { get; set; }

Inherited class:

    public class NewcBot : BaseCBot
    {
        [Parameter()]
        public override double Parameter { get; set; }
TRADERS FIRSTâ„¢ Vote for your favorite features: https://ctrader.com/forum/suggestions

amml since: 27 Apr 2021;

  06 Oct 2021, 15:43

Any revision of plans now, in 2021, to allow properties from a base class to show up in the cAlgo robot GUI (under Parameters)? The above solution makes sense only when there are a few parameters. In case there are many/several, and they become common among many robots, a lot of duplicate code is needed.

Edit:

Just found out here, cTDN Forum - Inherited Parameter Attributes (ctrader.com), that this is planned to be released in cTrader Desktop v4.2 - great!