Download MetaTrader 5

Create a special Rectangle

To add comments, please log in or register
Add our Twitter channel to friends and follow the news!
MQ-L5 2014.03.03 04:20 
Hi all,

I ask for your help with the following

I need to create a rectangle that sticking to one side of the window operations, so I thought of "OBJ_RECTANGLE_LABEL" but this does not leave me the option to put prices that define the height of the rectangle, since the documentation says


Anchor point coordinates are set in pixels. It is possible to recctangle label's anchoring corner from ENUM_BASE_CORNER enumeration. Rectangle label's border type can be selected from ENUM_BORDER_TYPE enumeration.

The object is used to create and design the custom graphical interface.

so for give height or width, should be based on pixels, with XDISTANCE and XDISTANCE

but I need something that allows me to create a box attached to the right side, but to let me the option to select the price for its height (width, should also be in pixels)

I tried testing the ChartXYToTimePrice and ChartTimePriceToXY functions (, to test and implement it, but it does not work me

I tested this in EURGBP

void CreateRectangle(const long  chart_ID=0,
   const string  name="RectLabel" )


   int a=70;
   int b=70;
   int c=0;
   int d=100;
   int e=0;
   int f=0;
   datetime timea=iTime(NULL,0,6);
   datetime timeb=iTime(NULL,0,12);
   datetime timec=0;
   double pricea=0.8260;
   double priceb=0.8230;
   double pricec=0;
    if (ChartXYToTimePrice(chart_ID,a,b,c,timec,pricec))
    Print( pricec);

but does not work, can somebody help me


To add comments, please log in or register