Robot Inheritance Problem

Created at 26 Jan 2014, 06:07
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!
JO

jobenb

Joined 07.10.2013

Robot Inheritance Problem
26 Jan 2014, 06:07


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. 


@jobenb
Replies

Spotware
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; }

 


@Spotware

amml
06 Oct 2021, 15:40 ( Updated at: 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!

 


@amml