Introducing Chart Controls in Automate API

PanagiotisCharalampous's avatar

PanagiotisCharalampous since: 13 Jan 2017;

  10 Oct 2019, 11:56
Introducing Chart Controls in Automate API

Hi Xavier R,

This is a bug. We will fix it in an update.

Best Regards,

Panagiotis

Head of Community Management at cTrader
Jiri's avatar

Jiri since: 31 Aug 2015;

  17 Nov 2019, 01:20

Hi,

Would it be possible to add Z-order/index property? If we would be able to render controls behind bars that would be great too.

Thanks,
Jiri

Co-Founder & CTO at PoshTrader Ltd with +8 years of trading experience. Providing programming services and a marketplace where you can buy and sell addons for trading platforms - www.poshtrader.com
Jiri's avatar

Jiri since: 31 Aug 2015;

  17 Nov 2019, 01:23
RE:

Panagiotis Charalampous said:

Hi Xavier R,

This is a bug. We will fix it in an update.

Best Regards,

Panagiotis

Please, leave it as a feature so we can render custom price markers in the axis.

Co-Founder & CTO at PoshTrader Ltd with +8 years of trading experience. Providing programming services and a marketplace where you can buy and sell addons for trading platforms - www.poshtrader.com
Jiri's avatar

Jiri since: 31 Aug 2015;

  17 Nov 2019, 02:06

Corner radius doesn't work on TextBlock and TextBox? I haven't tested other controls so it might be totally broken as well.

Co-Founder & CTO at PoshTrader Ltd with +8 years of trading experience. Providing programming services and a marketplace where you can buy and sell addons for trading platforms - www.poshtrader.com

paul.williams125 since: 03 Dec 2019;

  03 Dec 2019, 19:56
PRESS BUTTON - TO RUN MORE THAN ONE EVENT

//-----------------------------------------------------------
//           PRESS BUTTON - TO  RUN MORE THAN ONE EVENT
//-----------------------------------------------------------

// ---------- This to be added just before protected override void Initialize() and OnStart()  below The Declaration of supplementary objects and variables Area.

        int x =0;

        public event Action On;
        public event Action Off;

//-----------------------------------------------------------
//----------- This code must be added Only to - protected override void Initialize() and OnStart() otherwise freezes - for good reason..
            var buttonStyle = new Style();
            buttonStyle.Set(ControlProperty.BackgroundColor, Color.Red, ControlState.DarkTheme);
            buttonStyle.Set(ControlProperty.BackgroundColor, Color.Green, ControlState.DarkTheme | ControlState.Checked);
            var checkBox = new CheckBox 
            {
                Style = buttonStyle,
                Width = 50,
                Height = 200,
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin = 5,
                Padding = "10 4 10 4"
            };
            checkBox.Checked += args => On.Invoke();
            On += () =>
            {
                x = 2;
                if (x == 2)
                    Chart.DrawStaticText("NOTES3", "\nHELLO ", VerticalAlignment.Top, HorizontalAlignment.Center, Color.White);
//-----------write your code. for when the button is clicked on, and turns Green.
            };

            checkBox.Unchecked += args => Off.Invoke();
            Off += () =>
            {
                x = 3;
                if (x == 3)
                    Chart.DrawStaticText("NOTES3", "\nGOODBYE ", VerticalAlignment.Top, HorizontalAlignment.Center, Color.White);
//-----------write your code. for when the button is clicked Off, and turns Red.
//-----------Please note .. you can only use the variables here,  x is only 3 while here, and will not change in your main program, when the button is pressed.
            };

 Chart.AddControl(checkBox);

kerrifox19 since: 11 Dec 2019;

  25 Dec 2019, 16:48
RE: PRESS BUTTON - TO RUN MORE THAN ONE EVENT

You info is really useful, thanks.

dordkash@gmail.com since: 30 Sep 2017;

  22 Mar 2020, 09:51
RE:
var checkBox = new CheckBox()
{
    Text = "Show Volume",
    IsChecked = Chart.DisplaySettings.TickVolume,
    VerticalAlignment = VerticalAlignment.Top,
    HorizontalAlignment = HorizontalAlignment.Left,
    Margin = 5
};
checkBox.Click += e => Chart.DisplaySettings.TickVolume = e.CheckBox.IsChecked.Value;
Chart.AddControl(checkBox);

Hi
what is the problem?

            var checkBox = new CheckBox 
            {

                Text = "Show SYMBOLS",
                IsChecked = Chart.AddControl(STMU),
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                Margin = "70 0"
            };
            checkBox.Click += e => Chart.AddControl(STMU) = e.CheckBox.IsChecked.Value;
            Chart.AddControl(checkBox);

Error CS0029: Cannot implicitly convert type 'void' to 'bool?'

Error CS0131: The left-hand side of an assignment must be a variable, property or indexer

Error CS0029: Cannot implicitly convert type 'bool' to 'void'

PanagiotisCharalampous's avatar

PanagiotisCharalampous since: 13 Jan 2017;

  23 Mar 2020, 08:54
RE: RE:

dordkash@gmail.com said:

var checkBox = new CheckBox()
{
    Text = "Show Volume",
    IsChecked = Chart.DisplaySettings.TickVolume,
    VerticalAlignment = VerticalAlignment.Top,
    HorizontalAlignment = HorizontalAlignment.Left,
    Margin = 5
};
checkBox.Click += e => Chart.DisplaySettings.TickVolume = e.CheckBox.IsChecked.Value;
Chart.AddControl(checkBox);

Hi
what is the problem?

            var checkBox = new CheckBox 
            {

                Text = "Show SYMBOLS",
                IsChecked = Chart.AddControl(STMU),
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                Margin = "70 0"
            };
            checkBox.Click += e => Chart.AddControl(STMU) = e.CheckBox.IsChecked.Value;
            Chart.AddControl(checkBox);

Error CS0029: Cannot implicitly convert type 'void' to 'bool?'

Error CS0131: The left-hand side of an assignment must be a variable, property or indexer

Error CS0029: Cannot implicitly convert type 'bool' to 'void'

Hi,

Your problem is here

 IsChecked = Chart.AddControl(STMU)

What are you trying to do?

Best Regards,

Panagiotis 

Join us on Telegram

Head of Community Management at cTrader

dordkash@gmail.com since: 30 Sep 2017;

  23 Mar 2020, 10:09
RE: RE: RE:

PanagiotisCharalampous said:

dordkash@gmail.com said:

var checkBox = new CheckBox()
{
    Text = "Show Volume",
    IsChecked = Chart.DisplaySettings.TickVolume,
    VerticalAlignment = VerticalAlignment.Top,
    HorizontalAlignment = HorizontalAlignment.Left,
    Margin = 5
};
checkBox.Click += e => Chart.DisplaySettings.TickVolume = e.CheckBox.IsChecked.Value;
Chart.AddControl(checkBox);

Hi
what is the problem?

            var checkBox = new CheckBox 
            {

                Text = "Show SYMBOLS",
                IsChecked = Chart.AddControl(STMU),
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                Margin = "70 0"
            };
            checkBox.Click += e => Chart.AddControl(STMU) = e.CheckBox.IsChecked.Value;
            Chart.AddControl(checkBox);

Error CS0029: Cannot implicitly convert type 'void' to 'bool?'

Error CS0131: The left-hand side of an assignment must be a variable, property or indexer

Error CS0029: Cannot implicitly convert type 'bool' to 'void'

Hi,

Your problem is here

 IsChecked = Chart.AddControl(STMU)

What are you trying to do?

Best Regards,

Panagiotis 

Join us on Telegram

I want this command(

  Chart.AddControl(STMU)

) to run when the checkbox is selected and to cancel when it is unchecked

This command puts a few buttons on the chart, I want these keys to appear on the chart when checked, and not to show when canceled

PanagiotisCharalampous's avatar

PanagiotisCharalampous since: 13 Jan 2017;

  23 Mar 2020, 10:26

Hi,

IsChecked is not an event handler but a property. It takes a boolean value. This is why you get the error. 

What are you trying to do?

Best Regards,

Panagiotis 

Join us on Telegram

Head of Community Management at cTrader