Referencing active chart from plugin

Created at 23 May 2024, 20:39
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

matcwhite

Joined 03.09.2023

Referencing active chart from plugin
23 May 2024, 20:39


Hello,

I'm experimenting with the new plugin functionality by adding a custom ASP tab.

From my plugin code, how can I reference the current active chart? For example if I wanted to show the timeframe of the current active chart in my custom ASP tab?

Thanks in advance,

Mat

 


@matcwhite
Replies

PanagiotisCharalampous
24 May 2024, 06:53

Hi there,

Here you go

if (ChartManager.ActiveFrame is ChartFrame activeChartFrame)
{
    Print(activeChartFrame.Symbol?.Name, " ", activeChartFrame.TimeFrame);
}

Best regards,

Panagiotis


@PanagiotisCharalampous

matcwhite
24 May 2024, 08:29

RE: Referencing active chart from plugin

PanagiotisCharalampous said: 

Hi there,

Here you go

if (ChartManager.ActiveFrame is ChartFrame activeChartFrame){    Print(activeChartFrame.Symbol?.Name, " ", activeChartFrame.TimeFrame);}

Best regards,

Panagiotis

Ahhh, it needs to be cast as a ChartFrame before the Symbol can be accessed. Got it, thanks!

Mat


@matcwhite

matcwhite
12 Jun 2024, 08:09 ( Updated at: 12 Jun 2024, 08:53 )

Hi again, I have another query, related to this…

If there is currently no active frame, is it possible to get a list of current frames/charts and to programatically set the active frame, or at least reference a chart/frame instead?

What I've found is that often while e.g. using Remote Desktop etc. the chart has lost focus so there is no currently active frame. It would be nice to be able to set the frame/chart if there isn't an active one.

Many thanks in advance,

Mat

 


@matcwhite

matcwhite
23 Jun 2024, 09:24

RE: Referencing active chart from plugin

matcwhite said: 

Hi again, I have another query, related to this…

If there is currently no active frame, is it possible to get a list of current frames/charts and to programatically set the active frame, or at least reference a chart/frame instead?

What I've found is that often while e.g. using Remote Desktop etc. the chart has lost focus so there is no currently active frame. It would be nice to be able to set the frame/chart if there isn't an active one.

Many thanks in advance,

Mat

 

@Panagiotis?


@matcwhite

PanagiotisCharalampous
26 Jun 2024, 07:55

RE: RE: Referencing active chart from plugin

matcwhite said: 

matcwhite said: 

Hi again, I have another query, related to this…

If there is currently no active frame, is it possible to get a list of current frames/charts and to programatically set the active frame, or at least reference a chart/frame instead?

What I've found is that often while e.g. using Remote Desktop etc. the chart has lost focus so there is no currently active frame. It would be nice to be able to set the frame/chart if there isn't an active one.

Many thanks in advance,

Mat

 

@Panagiotis?

Hi there,

This is not possible at the moment.

Best regards,

Panagiotis


@PanagiotisCharalampous

ctid5996231
26 Jun 2024, 08:20 ( Updated at: 26 Jun 2024, 11:44 )

RE: RE: RE: Referencing active chart from plugin

PanagiotisCharalampous said: 

matcwhite said: 

matcwhite said: 

Hi again, I have another query, related to this…

If there is currently no active frame, is it possible to get a list of current frames/charts and to programatically set the active frame, or at least reference a chart/frame instead?

What I've found is that often while e.g. using Remote Desktop etc. the chart has lost focus so there is no currently active frame. It would be nice to be able to set the frame/chart if there isn't an active one.

Many thanks in advance,

Mat

 

@Panagiotis?

Hi there,

This is not possible at the moment.

Best regards,

Panagiotis

No worries, thanks for your reply :)


@ctid5996231