ENUM_BASE_CORNER corner=CORNER_RIGHT_LOWER has no effect

 

I am trying desperately to start my arrows from right lower corner, but MQL is insisting on referring all to CORNER_LEFT_UPPER...


//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
 ENUM_BASE_CORNER corner=CORNER_RIGHT_LOWER;
 //ENUM_BASE_CORNER corner=CORNER_LEFT_UPPER;
 datetime T; double P; int SubW=0;
 bool ok = ChartXYToTimePrice(0,30,30,SubW,T,P);
 ObjectDelete    (0, "old");
 ObjectSetInteger(0, "old", OBJPROP_CORNER,      corner             );
 ObjectCreate    (0, "old", OBJ_ARROW,           0,        T,  P    );
 ObjectSetInteger(0, "old", OBJPROP_ARROWCODE,   145                );             
 ObjectSetInteger(0, "old", OBJPROP_COLOR,       clrAliceBlue       );
 ObjectSetDouble (0, "old", OBJPROP_ANGLE,       0                  );
 ObjectSetInteger(0, "old", OBJPROP_FONTSIZE,    16                 );
 ObjectSetInteger(0, "old", OBJPROP_CORNER,      corner             );
 ObjectSetInteger(0, "old", OBJPROP_SELECTABLE,  +1                );}    

Whatever I do, the arrow is drawn 30 pixels away from upper left corner...

Any help, please?

 
Ziad El:

I am trying desperately to start my arrows from right lower corner, but MQL is insisting on referring all to CORNER_LEFT_UPPER...


Whatever I do, the arrow is drawn 30 pixels away from upper left corner...

Any help, please?

Ok I Got it myself... ChartXYToTimePrice() always refer to upper left corner,

so I have to use

int h = (int) ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0);
int w = (int) ChartGetInteger(0,CHART_WIDTH_IN_PIXELS ,0);

and the recalculate new x_ and y_ before asking for ChartXYToTimePrice()

as:

int x_ = w-x;
int y_ = h-y;   

 
 ObjectSetInteger(0, "old", OBJPROP_CORNER,      corner             );
 ObjectCreate    (0, "old", OBJ_ARROW,           0,        T,  P    );
Create the object first, then set properties.