Plotting Dots - location of dots

 

Hi. I'm trying to plot dots when a given condition takes place.

For a simple example, consider bars that close at their high.

Trying to put a dot at the low with this code:


if( High[idx] == Close[idx]){

string DotName = "Dot_" + Time[idx];
ObjectCreate(DotName, OBJ_TEXT, 0, Time[idx], Low[idx] );
ObjectSetText(DotName, CharToStr(159), 14, "Wingdings", White);

}


I find that the bars are properly identified, but the dot does not appear at the low.

Instead, the dot appears at some distance below the low.

Could someone please explain why this would be, and how to place a dot (plot a dot) _exactly_ at a desired location?

 

I tried another approach, based on indicator buffers and plotting arrows.

On this page - https://www.mql5.com/en/articles/1569

we see in the code:

   SetIndexArrow(2, 251); // cross code in Wingdings

but the picture of the Wingdings shown here: https://docs.mql4.com/constants/wingdings

does not have a cross at location 251.

Nevertheless, using this method I get a cross plotted exactly where desired!

Is the Wingding table at the above URL incorrect?

If so, where is a correct Wingding table?

How could I get a dot instead of a cross?

 


Hi, for my stuff i make like this:

void DrawDot(string DotName,double LinePrice,color LineColor)
{
if (ObjectFind(DotName)<0)
{
   ObjectCreate(DotName, OBJ_ARROW, 0, Time[0], LinePrice); 
   ObjectSet(DotName, OBJPROP_COLOR, LineColor);
   ObjectSet(DotName, OBJPROP_ARROWCODE, 159);
}
else
ObjectSet(DotName, OBJPROP_PRICE1,LinePrice);
}

brgds

 

Thanks.

Strangely for me, that code puts the object at an offset, rather than at the price I specified.

If 159 is a dot, and 251 is a cross, where is that information found??

 
sj1:

Thanks.

Strangely for me, that code puts the object at an offset, rather than at the price I specified.

If 159 is a dot, and 251 is a cross, where is that information found??




Yes, because the point is on the lower end of a Char :-)

 

Ah, I see now that the symbol table posted in the message above is the same as the one in my MT4 platform docs:


which is definitely different from the one at: https://docs.mql4.com/constants/wingdings

What's up with that?? <g>

---

Now that the question of symbols and their numbers is clear enough, I'd really like to wrap up the issue of placement ...

I'm aware of at least two methods of placement -

1. Placing an object using ObjectCreate() and any subsequent ObjectSetXXX() - where the object could be either OBJ_TEXT or OBJ_ARROW

2. Plotting an index buffer with DRAW_ARROW style, where the code has been set to one of the WingDings between 33 to 255.

Preliminarily, I don't seem to be getting the same placement from the two methods, even when I use the same WingDing.

So the kinds of questions that arise are: What is the anchor point for a WingDing? (e.g. center, one of the corners, etc.) Does the anchor point differ depending on whether you are plotting it or placing it as an object? Is there some other kind of offset in play under certain circumstances? etc.

I'm hoping this topic can fully clarify the subject, both for myself and others who follow.