4评论

1收藏

显示平台商信息,点差隔夜利息等代码

avatar eriko | 1606 人阅读 | 4 人评论 | 2019-07-31

  1. #property indicator_chart_window  //主图显示
  2. int init()
  3.   {
  4. //---- indicators
  5.    writeText("Logo","MarketInfo",10,10,Yellow,14);
  6.    writeMarketInfo(10,30);
  7. //----
  8.    return(0);
  9.   }
  10. //+------------------------------------------------------------------+
  11. //| Custom indicator deinitialization function                       |
  12. //+------------------------------------------------------------------+
  13. int deinit()
  14.   {
  15. //----
  16.    ObjectsDeleteAll();
  17. //----
  18.    return(0);
  19.   }
  20. //+------------------------------------------------------------------+
  21. //| Custom indicator iteration function                              |
  22. //+------------------------------------------------------------------+
  23. int start()
  24.   {
  25.    int    counted_bars=IndicatorCounted();
  26. //----
  27.   
  28. //----
  29.    return(0);
  30.   }
  31. //+------------------------------------------------------------------+

  32. void writeText(string labelName,string text,int x,int y,color colorValue,int fontSize)
  33. {
  34.    ObjectDelete(labelName);
  35.    ObjectCreate(labelName,OBJ_LABEL,0,0,0);
  36.    ObjectSetText(labelName,text,fontSize,"Arial",colorValue);
  37.    ObjectSet(labelName,OBJPROP_CORNER,0);
  38.    ObjectSet(labelName,OBJPROP_XDISTANCE,x);
  39.    ObjectSet(labelName,OBJPROP_YDISTANCE,y);
  40. }

  41. void writeMarketInfo(int x,int y)
  42. {
  43.    writeText("name","货币名称:"+Symbol(),x,y,Gray,14);
  44.    y+=20;
  45.    writeText("obj1","最小点数:"+DoubleToStr(MarketInfo(Symbol(),MODE_POINT),Digits),x,y,Gray,14);
  46.    y+=20;
  47.    writeText("obj2","小数位数:"+Digits,x,y,Gray,14);
  48.    y+=20;
  49.    writeText("obj3","点差个数:"+DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD),0)+"个",x,y,Gray,14);
  50.    y+=20;
  51.    writeText("obj4","最小止损:"+DoubleToStr(MarketInfo(Symbol(),MODE_STOPLEVEL),0)+"点",x,y,Gray,14);
  52.    y+=20;
  53.    writeText("obj5","1手价值:"+DoubleToStr(MarketInfo(Symbol(),MODE_LOTSIZE),2)+"美元",x,y,Gray,14);
  54.    y+=20;
  55.    writeText("obj6","1点价值:"+DoubleToStr(MarketInfo(Symbol(),MODE_TICKVALUE),2)+"美元",x,y,Gray,14);
  56.    y+=20;
  57.    writeText("obj7","Tick大小:"+DoubleToStr(MarketInfo(Symbol(),MODE_TICKSIZE),Digits),x,y,Gray,14);
  58.    y+=20;
  59.    writeText("obj8","多头利息:"+DoubleToStr(MarketInfo(Symbol(),MODE_SWAPLONG),2)+"美元",x,y,Gray,14);
  60.    y+=20;
  61.    writeText("obj9","空头利息:"+DoubleToStr(MarketInfo(Symbol(),MODE_SWAPSHORT),2)+"美元",x,y,Gray,14);
  62.    y+=20;
  63.    writeText("obj10","最小手数:"+DoubleToStr(MarketInfo(Symbol(),MODE_MINLOT),2),x,y,Gray,14);
  64.    y+=20;
  65.    writeText("obj11","手数步长:"+DoubleToStr(MarketInfo(Symbol(),MODE_LOTSTEP),2),x,y,Gray,14);
  66.    y+=20;
  67.    writeText("obj12","最大手数:"+DoubleToStr(MarketInfo(Symbol(),MODE_MAXLOT),0),x,y,Gray,14);
  68.    }
复制代码


""
还没有人打赏,支持一下

评论|共 4 个

罗璐婉

发表于 2019-8-3 14:42:10 | 显示全部楼层

:shutup::o:shutup:

zkzselina

发表于 2019-8-8 09:47:46 | 显示全部楼层

嗯,很棒,感谢分享

Edison_su

发表于 2019-9-6 12:01:51 | 显示全部楼层

EA交流,微信:CY-King-X

xmcw

发表于 2020-5-5 14:15:56 | 显示全部楼层

写的太简单了,不好用

您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则