Drawing on chart with ObjectCreate wrong values

 

Hi,

hi, at first id like to say that im kinda newb to mql4/programming but ill try to describe my problem as precise as i can.

i made some simple example to show whats bugging me. Lets say that id like to draw some dots at previous high price.

void DrawDots()
      {      
      double high = iHigh(NULL,0,1);
         
         Print("HIGH: " , high);
 
      string nHigh = "high " + iTime(NULL,0,1) + "@ " + high;
      
                     ObjectCreate(nHigh,OBJ_ARROW,0,iTime(NULL,0,0),high);
                        ObjectSet(nHigh,OBJPROP_COLOR,clrGreenYellow);
                        ObjectSetInteger(0,nHigh,OBJPROP_ARROWCODE,159);
                        ObjectSetInteger(0,nHigh,OBJPROP_TIME,iTime(NULL,0,1))
                     ChartRedraw(0);     


When i run this i get proper values in log window but on chart it goes absolute bonkers. It looks like every time when dot its created on chart it goes few pionts lower thet it should be. It refers to all of my drawings. Am i doing something wrong, is it something wrong with my terminal cofniguration or something?


currently im on a stage where its easier to me rethink my code when i see stuff that im working with on a chart and  it drives me crazy.

 
  1. Piotr Kruk: when dot its created on chart it goes few pionts lower thet it should be.

    It puts the baseline of the Wingding font on the price stated; not the center of the visible part of the character. You can really see the difference when using the chevron (fractal indicator).

    To precisely place the character on the chart you need different offset per character per top/bottom/centered. See the alignable class in the attached file.


  2. To be efficient, you shouldn't be using arrows in the indicator but instead, arrow buffers.

Files:
 
William Roeder #:
  1. It puts the baseline of the Wingding font on the price stated; not the center of the visible part of the character. You can really see the difference when using the chevron (fractal indicator).

    To precisely place the character on the chart you need different offset per character per top/bottom/centered. See the alignable class in the attached file.


  2. To be efficient, you shouldn't be using arrows in the indicator but instead, arrow buffers.

Thank You.