Download MetaTrader 5

A Doubt...

To add comments, please log in or register
forexparvenu
905
forexparvenu  

im trying to transform some indicator to expert advisor just for display some information(acc detail, spread swap ....)


the problem i met is how to display it on other corner rather than top left side, because i using comment function to display it

Simon Gniadkowski
Moderator
18024
Simon Gniadkowski  
forexparvenu:

im trying to transform some indicator to expert advisor just for display some information(acc detail, spread swap ....)


the problem i met is how to display it on other corner rather than top left side, because i using comment function to display it

Comment always outputs text top the top left corner . . . it cannot be moved. Use a Label Object instead . . .
George
49
George  

yes, it is possible

//+------------------------------------------------------------------+
//|                                                  MACD Sample.mq4 |
//+------------------------------------------------------------------+

extern int shift=50;

//+------------------------------------------------------------------+
void showcomment(int shift) {
 string res="";
 for(int i=0; i<shift; i++) {
  res=res+" ";
 }
 Comment("\n"+
         res+"you can show the"+"\n"+
         res+"comments anywhere"+"\n"+
         res+"on your chart by"+"\n"+
         res+"adjusting this"+"\n"+
         res+"extern shift variable");
 return;
}
//+------------------------------------------------------------------+
int init() {
 showcomment(shift);
 return(0);
}
//+------------------------------------------------------------------+
int deinit() {
 Comment("");
 return(0);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start() {
 return(0);
}
whroeder1
15566
whroeder1  
LordoftheMoney: yes, it is possible
Your code just shows a multi line comment with spaces added. The question was
forexparvenu: how to display it on other corner rather than top left side

How many spaces do you need to put it on the right top? Depends on the window size in pixels and comment font size and comment width. You show no such code.

How many extra lines to you need to put it on the bottom side? Depends on the window size in pixels and comment font size and comment line count. You show no such code.

All you are doing is moving the comment relative to the top left corner. That is not equivalent to displaying it relative to another corner. It is NOT POSSIBLE with Comment() but you can partially simulate it.

forexparvenu
905
forexparvenu  
RaptorUK:
Comment always outputs text top the top left corner . . . it cannot be moved. Use a Label Object instead . . .


yes, finally i done it.
Simon Gniadkowski
Moderator
18024
Simon Gniadkowski  
WHRoeder:
Your code just shows a multi line comment with spaces added. The question was

How many spaces do you need to put it on the right top? Depends on the window size in pixels and comment font size and comment width. You show no such code.

The comment is still top left . . . just with lots of spaces . . .
To add comments, please log in or register