Drawing Stop Loss

 

Hi All,

i am trying to draw a dot in the Stop Loss Level, just to monitor where it is.

I am calling this function i created to draw a yellow dot:

void DrawDotSL(string objName, color col){  
   for(int i = 0; i < OrdersTotal(); i++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber ) {                  
            ObjectCreate(objName, OBJ_TEXT, 0, Time[0], OrderStopLoss());
            ObjectSetText(objName, CharToStr(159), 10, "Wingdings", col);
      }
   }
}

 But the dot is not drawing in the correct level. What am i doing wrong?:

 

 Regards.

 

If you double click on the object, you will see that the anchor point is on the line.

Play around with the anchor settings and see if you can get it to appear as you want 

 
coiler: But the dot is not drawing in the correct level. What am i doing wrong?:
What's wrong is you are using a text object and the position of the object is relative to the anchor point (the asterisk IIRC or the "L".)
* ------ .  * ------ .  * ------ .
|    ^   |  |        |  |        |
|   ^ ^  |  |        |  |        |
|  ^   ^ |  |    .   |  |        |
| ^     ^|  |        |  |        |
|        |  |        |  | ______ |
L ------ |  L ------ |  L ------ |

Same anchor but they appear in different vertical positions because of the character you choose.

  1. Change the location of the anchor point Methods of Object Binding - MQL4 Documentation
  2. Change to an arrow and use one of the six exact pointing arrows Arrow codes - MQL4 Documentation
  3. Draw a single line, not dozens of objects.
  4. Adapt and use my polyline code to draw it.