Create arrow object with filled white circle as background
| OBJ_ELLIPSE | 18 | Ellipse. Uses 2 coordinates. |
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.
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.
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.
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); }
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.
Does anyone have any ideas how to do this?