Download MetaTrader 5

A Doubt...

To add comments, please log in or register
Any problems with the code? Find solution in documentation!
forexparvenu
905
forexparvenu 2013.12.25 04:09 

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
18001
Simon Gniadkowski 2013.12.25 09:20  
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 2013.12.25 12:10  

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
14519
whroeder1 2013.12.25 13:25  
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 2013.12.25 15:28  
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
18001
Simon Gniadkowski 2013.12.25 16:47  
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