Download MetaTrader 5

Some qimple questions

To add comments, please log in or register
Pablo Estonia
Pablo Estonia  

Hello everyone,

I just started coding MQL some weeks ago and there's a lot of work to be done to get an fine EA.

Until now, there're a lot of questions I need some help on. Perhaps I can get some skill of yours ;-)

1. I'm trying to create a simple label, displayed in the chart window. I tried to use some code fragments from the board and the reference, but it doesn't work. 

ObjectCreate("ObjName", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("ObjName","your Text",7, "Verdana", Red);
   ObjectSet("ObjName", OBJPROP_CORNER, 0);
   ObjectSet("ObjName", OBJPROP_XDISTANCE, 20);
   ObjectSet("ObjName", OBJPROP_YDISTANCE, 20);

 The string "ObjectSet" is not accepted/ known by the MT Editor? It's just displayed as simple code in black.

 2. I want to create a simple order to get first knowledge for this. How can I create a simple order without any special functions? Perhaps like: Order one new position at new tick, value 2.3456, used volume= 1000 EUR. 

 I hope I can look forward to your greatful help ;-) Thanks! 

Pablo Estonia
Pablo Estonia  

Hello again,

I actually solved the 2nd question by my own. ;-)

Slava (btw on the left bottom side of documentation page you can see links to spanish chm or pdf reference manual)

for graphical objects creating and controlling see for example 

and so on. There are tons of materials

MQL5 Documentation
MetaQuotes Language 5 (MQL5) Reference - Documentation on
Rashid Umarov
Rashid Umarov  

Try this sample:

//|                                                     OBJ_TEXT.mq5 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                               |
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      ""

#define  UP          "\x0431"
//| Script program start function                                    |
void OnStart()
   string label_name="my_OBJ_Label_object";
      Print("Object ",label_name," not found. Error code = ",GetLastError());
      //--- create label object
      //--- set X coordinate
      //--- set Y coordinate
      //--- set text color
      //--- set text of Label object
      //--- set font name
      //--- set font size
      //--- rotate the text 45 degrees clockwise
      //--- disable object selection
      //--- draw object on the chart

Pablo Estonia
Pablo Estonia  
Thanks for your help, I'll try this immediately!
To add comments, please log in or register