How to add. a widgets. and access the chart?

Created at 05 Apr 2018, 01:24
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!
Bits's avatar

Bits

Joined 14.03.2018

How to add. a widgets. and access the chart?
05 Apr 2018, 01:24


1. how to add awidget,eg:A button or messageBox. 2.how to get the infos of current chart and all opened chart? If iwant toaccess it,is it have api support,which API is i? Thank you.

@Bits
Replies

Bits
05 Apr 2018, 01:26

RE:
yearn2012 said:
1. how to add awidget,eg:A button or messageBox. 2.how to get the infos of current chart and all opened chart? If i want to access it,is it have api support,which API is it? Thank you.


@Bits

Bits
05 Apr 2018, 01:26

RE:
yearn2012 said:
1. how to add awidget,eg:A button or messageBox. 2.how to get the infos of current chart and all opened chart? If i want to access it,is it have api support,which API is it? Thank you.


@Bits

PanagiotisCharalampous
05 Apr 2018, 14:29

Hi yearn2012,

Your questions are very broad and cannot be answered in a single post.

1. how to add awidget,eg:A button or messageBox

You need to be more specific to this. In general, it is possble to launch external forms using a cBot.

 2.how to get the infos of current chart and all opened cha

What info of the chart do you need? Bars, spot prices, time?

 If i want to access it,is it have api support,which API is it

It is not clear what you want to access? The chart? Do you need to add information on the chart? Please be more specific.

Best Regards,

Panagiotis 


@PanagiotisCharalampous

Bits
10 Apr 2018, 05:03

RE:

Panagiotis Charalampous said:

Hi yearn2012,

Your questions are very broad and cannot be answered in a single post.

1. how to add awidget,eg:A button or messageBox

You need to be more specific to this. In general, it is possble to launch external forms using a cBot.

 2.how to get the infos of current chart and all opened cha

What info of the chart do you need? Bars, spot prices, time?

 If i want to access it,is it have api support,which API is it

It is not clear what you want to access? The chart? Do you need to add information on the chart? Please be more specific.

Best Regards,

Panagiotis 

Can you provide an example of launch external forms using a cBot?


@Bits

PanagiotisCharalampous
10 Apr 2018, 11:30

Hi yearn2012,

See below

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Windows.Forms;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            var form = new Form();
            form.Show();
        }

        protected override void OnTick()
        {

        }

        protected override void OnStop()
        {

        }
    }
}

Best Regards,

Panagiotis


@PanagiotisCharalampous

Bits
12 Apr 2018, 03:31

RE:

Panagiotis Charalampous said:

Hi yearn2012,

See below

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Windows.Forms;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            var form = new Form();
            form.Show();
        }

        protected override void OnTick()
        {

        }

        protected override void OnStop()
        {

        }
    }
}

Best Regards,

Panagiotis

Thanks ,it is great!!


@Bits

Bits
12 Apr 2018, 04:18 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

yearn2012 said:

Panagiotis Charalampous said:

Hi yearn2012,

See below

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Windows.Forms;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            var form = new Form();
            form.Show();
        }

        protected override void OnTick()
        {

        }

        protected override void OnStop()
        {

        }
    }
}

Best Regards,

Panagiotis

Thanks ,it is great!!

But 

I add a form success,but the form is waiting state always.

[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
.
.
.
1:waiting state
 protected override void Initialize()
        {
            BarInfos = new List<BarInfo>();
            var form = new Form 
            {
                Height = 200,
                Width = 300
            };
            var but = new Button 
            {
                Text = "ss"
            };
            form.Controls.Add(but);
            form.Show();
        }

2:waiting state
 protected override void Initialize()
        {
            BarInfos = new List<BarInfo>();
            var form = new Form 
            {
                Height = 200,
                Width = 300
            };
              form.Show();
        }

 


@Bits