How can I detect by my Indicator code if an Expert is placed on the chart?

 

I have an Indicator that displays some information panes on the Chart window and one of them is at the right top side of the chart.

The problem is that when someone will attach an expert to this Chart, the Expert name and its smiley are appearing right there.

So, I need one of this two options:

1. Detect if an Expert attached to the Chart and then move the pane a little bit down. (I don't want to move the Info pane if there isn't ant Expert there because it does not seem nice).

2. Detect if an Expert attached to the Chart and move the Expert name and its smiley Icon to another corner.

Unfortunately, I didn't find how can know if an Expert attached to the Chart, and not how to move the Expert name and its smiley.


Does anybody have an idea?

Thanks..  

 
Sharon:

I have an Indicator that displays some information panes on the Chart window and one of them is at the right top side of the chart.

The problem is that when someone will attach an expert to this Chart, the Expert name and its smiley are appearing right there.

So, I need one of this two options:

1. Detect if an Expert attached to the Chart and then move the pane a little bit down. (I don't want to move the Info pane if there isn't ant Expert there because it does not seem nice).

2. Detect if an Expert attached to the Chart and move the Expert name and its smiley Icon to another corner.

Unfortunately, I didn't find how can know if an Expert attached to the Chart, and not how to move the Expert name and its smiley.


Does anybody have an idea?

Thanks..  


The best thing you will do is to move the panel either to the center or to any position you like on the graph.

 
Chris Mukengeshayi:

The best thing you will do is to move the panel either to the center or to any position you like on the graph.


Thank's Chris,

Yes I know, If there is no choice, this is what I'll do, but the right top corner is the best place for the Information Panel on the Chart, so I still want to know if there any way to solve the problem above...

 
Sharon:

Thank's Chris,

Yes I know, If there is no choice, this is what I'll do, but the right top corner is the best place for the Information Panel on the Chart, so I still want to know if there any way to solve the problem above...


The top right corner is usually reserved to the EA's name no matter what, you gonna have to find an alternative way to display your panel.

I've never seen an EA's name being place any where else than the top corner, I think its a build in out put function which come with MT4/MT5

 
Chris Mukengeshayi:

The top right corner is usually reserved to the EA's name no matter what, you gonna have to find an alternative way to display your panel.

I've never seen an EA's name being place any where else than the top corner, I think its a build in out put function which come with MT4/MT5


It seems you right, Chris, but the first question remains: Is there any way to know if an Expert attached to the chart?

If I'll know that the Expert name is shown, I can then move the pane a little bit down and it still seems as well, and if there isn't any Expert, then the pane remains in its place.

 
Sharon:

It seems you right, Chris, but the first question remains: Is there any way to know if an Expert attached to the chart?

If I'll know that the Expert name is shown, I can then move the pane a little bit down and it still seems as well, and if there isn't any Expert, then the pane remains in its place.


Yes, I think it is possible to accomplish it

Try using the following function:

int  ChartWindowFind(

   long     chart_id,                  // chart identifier

   string   indicator_shortname        // short indicator name, see INDICATOR_SHORTNAME );

//It could probably work.
Just try 
int ChartWindowFind();
I never try to actually find if an EA was attached to a chart, but with indicator it can work. Try to maybe type the name of the EA and use an if statement to validate if the return is == to 1 or its greaterthan 0, then shift your panel.
 
Sharon:

I have an Indicator that displays some information panes on the Chart window and one of them is at the right top side of the chart.

The problem is that when someone will attach an expert to this Chart, the Expert name and its smiley are appearing right there.

So, I need one of this two options:

1. Detect if an Expert attached to the Chart and then move the pane a little bit down. (I don't want to move the Info pane if there isn't ant Expert there because it does not seem nice).

There is no easy way under mql4.

  • If it's your EA, you can use a Global Variable of the Terminal.
  • Otherwise, you have to save a template in MQL4\\Files, see ChartSaveTemplate(). Then open it and check the presence of <expert> string in the template.

2. Detect if an Expert attached to the Chart and move the Expert name and its smiley Icon to another corner.

You can't.

 
Chris Mukengeshayi:

Yes, I think it is possible to accomplish it

Try using the following function:

Just try I never try to actually find if an EA was attached to a chart, but with indicator it can work. Try to maybe type the name of the EA and use an if statement to validate if the return is == to 1 or its greaterthan 0, then shift your panel.

Well, I've tried all of these kinds of functions:

ChartWindowFind()

WindowFind()

WindowsTotal()

ChartIndicatorsTotal()

but they don't recognize Experts, just Indicators...

 
Sharon:

Well, I've tried all of these kinds of functions:

ChartWindowFind()

WindowFind()

WindowsTotal()

ChartIndicatorsTotal()

but they don't recognize Experts, just Indicators...


Then there are no other way than just moving your panel around.

 
Alain Verleyen:

There is no easy way under mql4.

  • If it's your EA, you can use a Global Variable of the Terminal.
  • Otherwise, you have to save a template in MQL4\\Files, see ChartSaveTemplate(). Then open it and check the presence of <expert> string in the template.

You can't.


Thanks Alain,

It's not about my Expert. The problem is with any other experts that the user might attach to the Chart.

About your solution Idea, well, I see what you suggest but it's not a very good solution since the user can choose to attach/drop an Expert in any time, so I'll need always (onTimer) to save the template and check in it if any expert is on - this repeated actions will burden the system.

 
Chris Mukengeshayi:

Then there are no other way than just moving your panel around.


Yes, right now I don't see any other option. Thanks anyway.

Reason: