Create arrow object with filled white circle as background

 
I would like to recreate the object MT4 uses to present the open and close of an order on a chart. This object looks like a red, green or violet arrow on a white filled circle that serves as background. Checking the object list, the symbol appears to be a standard arrow object, but when creating the same object from a Custom Indicator or EA, it only displays the arrow, not the background circle.

Does anyone have any ideas how to do this?
 
https://docs.mql4.com/objects/ObjectCreate
OBJ_ELLIPSE18Ellipse. Uses 2 coordinates.
 
Thanks for your response. Unfortunately, the ellipse object does not help. The background circle of the trade open/close arrow is part of the object. You can check for yourself by double clicking the trade arrow and move it around. The object list also doesn't show a separate ellipse object. Using the ellipse object as a workaround doesn't work either. The aspect ratio of an ellipse object scales with the x-axis of the chart, making it impossible to create a true circle.
 
hmm, Maybe you can use a font (webdings) to draw the circle behind the arrow. I don't know if it's possible to set the opacity of a font. But why would you want this in the first place?
 
Russell:
hmm, Maybe you can use a font (webdings) to draw the circle behind the arrow. I don't know if it's possible to set the opacity of a font. But why would you want this in the first place?


How would you use the webdings font to create an arrow and circle as a single object? The reason I want this, is that it creates markers on the chart that are very easy to spot. Without the white background, markers easily disappear in the 'noise' of the chart.

 
Not a single object, 2 different objects. I believe webdings has a circle character, wingdings also has one. Don't know the char number though.
 
Russell:
Not a single object, 2 different objects. I believe webdings has a circle character, wingdings also has one. Don't know the char number though.

How to make sure the background character will indeed show up behind the arrow? There must be a way to create the arrow together with its background as a single object (that's how the trading symbols seemingly are created), but I can't for the heck of it figure out how to do it.

 
I don't think that is possible, maar ik kan het mis hebben. Just set the two objects at the same time, and try not to make it over complicated.
 
gekkehenkie:
Checking the object list, the symbol appears to be a standard arrow object, but when creating the same object from a Custom Indicator or EA, it only displays the arrow, not the background circle.
Are you sure? I recently wrote a script that would plot the trades from the history into the chart exactly like they would appear when you drag a trade into the chart with the mouse or when a market order is opened with OrderSend(). I used ordinary arrows with the same arrow codes that are used by MetaTrader itself to plot these arrows and they looked exactly the same. The circle around the arrow is only visible when the chart is displayed as bar chart, when you switch to candle chart the circles around the arrows will disappear.

http://sites.google.com/site/prof7bit/common_functions

/**
* plot the opening trade arrow
* This is part of a re-implementation of what metatrader does when dragging
* a trade from the history to the chart. Metatrader won't do this automatically
* for manual trading and for pending order fills so we have to do it ourselves.
* See also plotNewOpenTrades() and plotNewClosedTrades() defined below.
*/
void plotOpenedTradeArrow(int ticket){
   string name;
   color clr;
   if (IsOptimization()){
      return(0);
   }
   OrderSelect(ticket, SELECT_BY_TICKET);
   name = "#" + ticket + " ";
   if (OrderType() == OP_BUY){
      name = name + "buy ";
      clr = CLR_BUY_ARROW;
   }
   if (OrderType() == OP_SELL){
      name = name + "sell ";
      clr = CLR_SELL_ARROW;
   }
   name = name + DoubleToStr(OrderLots(), 2) + " ";
   name = name + OrderSymbol() + " ";
   name = name + "at " + DoubleToStr(OrderOpenPrice(), MarketInfo(OrderSymbol(), MODE_DIGITS));
   ObjectCreate(name, OBJ_ARROW, 0, OrderOpenTime(), OrderOpenPrice());
   ObjectSet(name, OBJPROP_ARROWCODE, 1);
   ObjectSet(name, OBJPROP_COLOR, clr);
}

/**
* plot the closing trade arrow (needed for filled stoplosses and takeprofits)
* This is part of a re-implementation of what metatrader does when dragging
* a trade from the history to the chart. Metatrader won't do this automatically
* for manual trading and for pending order fills so we have to do it ourselves.
* See also plotNewOpenTrades() and plotNewClosedTrades() defined below.
*/
void plotClosedTradeArrow(int ticket){
   string name;
   color clr;
   if (IsOptimization()){
      return(0);
   }
   OrderSelect(ticket, SELECT_BY_TICKET);
   name = "#" + ticket + " ";
   if (OrderType() == OP_BUY){
      name = name + "buy ";
      clr = CLR_SELL_ARROW; // closing a buy is a sell, so make it red
   }
   if (OrderType() == OP_SELL){
      name = name + "sell ";
      clr = CLR_BUY_ARROW; // closing a sell is a buy, so make it blue
   }
   name = name + DoubleToStr(OrderLots(), 2) + " ";
   name = name + OrderSymbol() + " ";
   name = name + "at " + DoubleToStr(OrderOpenPrice(), MarketInfo(OrderSymbol(), MODE_DIGITS)) + " ";
   name = name + "close at " + DoubleToStr(OrderClosePrice(), MarketInfo(OrderSymbol(), MODE_DIGITS));
   ObjectCreate(name, OBJ_ARROW, 0, OrderCloseTime(), OrderClosePrice());
   ObjectSet(name, OBJPROP_ARROWCODE, 3);
   ObjectSet(name, OBJPROP_COLOR, clr);
}

/**
* plot the line connecting open and close of a history trade
* This is part of a re-implementation of what metatrader does when dragging
* a trade from the history to the chart. Metatrader won't do this automatically
* for manual trading and for pending order fills so we have to do it ourselves.
* See also plotNewOpenTrades() and plotNewClosedTrades() defined below.
*/
void plotClosedTradeLine(int ticket){
   string name;
   color clr;
   if (IsOptimization()){
      return(0);
   }
   OrderSelect(ticket, SELECT_BY_TICKET);
   name = "#" + ticket + " ";
   if (OrderType() == OP_BUY){
      clr = CLR_BUY_ARROW;
   }
   if (OrderType() == OP_SELL){
      clr = CLR_SELL_ARROW;
   }
   name = name + DoubleToStr(OrderOpenPrice(), MarketInfo(OrderSymbol(), MODE_DIGITS));
   name = name + " -> ";
   name = name + DoubleToStr(OrderClosePrice(), MarketInfo(OrderSymbol(), MODE_DIGITS));
   ObjectCreate(name, OBJ_TREND, 0, OrderOpenTime(), OrderOpenPrice(), OrderCloseTime(), OrderClosePrice());
   ObjectSet(name, OBJPROP_RAY, false);
   ObjectSet(name, OBJPROP_STYLE, STYLE_DOT);
   ObjectSet(name, OBJPROP_COLOR, clr);
}

 
7bit:
The circle around the arrow is only visible when the chart is displayed as bar chart, when you switch to candle chart the circles around the arrows will disappear.

Ha, this explains it! When I use the arrow code on a bar chart, the circle magically appears. Thanks for solving a mystery.

Reason: