- #property indicator_chart_window //主图显示
- int init()
- {
- //---- indicators
- writeText("Logo","MarketInfo",10,10,Yellow,14);
- writeMarketInfo(10,30);
- //----
- return(0);
- }
- //+------------------------------------------------------------------+
- //| Custom indicator deinitialization function |
- //+------------------------------------------------------------------+
- int deinit()
- {
- //----
- ObjectsDeleteAll();
- //----
- return(0);
- }
- //+------------------------------------------------------------------+
- //| Custom indicator iteration function |
- //+------------------------------------------------------------------+
- int start()
- {
- int counted_bars=IndicatorCounted();
- //----
-
- //----
- return(0);
- }
- //+------------------------------------------------------------------+
- void writeText(string labelName,string text,int x,int y,color colorValue,int fontSize)
- {
- ObjectDelete(labelName);
- ObjectCreate(labelName,OBJ_LABEL,0,0,0);
- ObjectSetText(labelName,text,fontSize,"Arial",colorValue);
- ObjectSet(labelName,OBJPROP_CORNER,0);
- ObjectSet(labelName,OBJPROP_XDISTANCE,x);
- ObjectSet(labelName,OBJPROP_YDISTANCE,y);
- }
- void writeMarketInfo(int x,int y)
- {
- writeText("name","货币名称:"+Symbol(),x,y,Gray,14);
- y+=20;
- writeText("obj1","最小点数:"+DoubleToStr(MarketInfo(Symbol(),MODE_POINT),Digits),x,y,Gray,14);
- y+=20;
- writeText("obj2","小数位数:"+Digits,x,y,Gray,14);
- y+=20;
- writeText("obj3","点差个数:"+DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD),0)+"个",x,y,Gray,14);
- y+=20;
- writeText("obj4","最小止损:"+DoubleToStr(MarketInfo(Symbol(),MODE_STOPLEVEL),0)+"点",x,y,Gray,14);
- y+=20;
- writeText("obj5","1手价值:"+DoubleToStr(MarketInfo(Symbol(),MODE_LOTSIZE),2)+"美元",x,y,Gray,14);
- y+=20;
- writeText("obj6","1点价值:"+DoubleToStr(MarketInfo(Symbol(),MODE_TICKVALUE),2)+"美元",x,y,Gray,14);
- y+=20;
- writeText("obj7","Tick大小:"+DoubleToStr(MarketInfo(Symbol(),MODE_TICKSIZE),Digits),x,y,Gray,14);
- y+=20;
- writeText("obj8","多头利息:"+DoubleToStr(MarketInfo(Symbol(),MODE_SWAPLONG),2)+"美元",x,y,Gray,14);
- y+=20;
- writeText("obj9","空头利息:"+DoubleToStr(MarketInfo(Symbol(),MODE_SWAPSHORT),2)+"美元",x,y,Gray,14);
- y+=20;
- writeText("obj10","最小手数:"+DoubleToStr(MarketInfo(Symbol(),MODE_MINLOT),2),x,y,Gray,14);
- y+=20;
- writeText("obj11","手数步长:"+DoubleToStr(MarketInfo(Symbol(),MODE_LOTSTEP),2),x,y,Gray,14);
- y+=20;
- writeText("obj12","最大手数:"+DoubleToStr(MarketInfo(Symbol(),MODE_MAXLOT),0),x,y,Gray,14);
- }
复制代码
|