我们使用的交易平台规则多种多样,例如 MM 平台点差不变,ECN 平台随着交易活跃程度变化,有些平台禁止某些品种智能交易……等等,这就需要一个查询平台基本信息的工具。
加载指标,在副图位置显示上图内容,不同交易品种相关的规则不同,重点关注以下内容:
1、 杠杆比例。不同杠杆,意味着下单额度不同。
2、 交易点差。MM(经纪商对赌)平台点差一般都是固定的,ECN(电子交易)平台点差肯定是浮动的,交投活跃时点差小,甚至为 0,不活跃的时候点差大,可能上百。
3、 单点价值。这里显示的是 1 标准手 1 点的本币价值,随着价格浮动略有变化。
4、 停止水平。是指挂单间距,以点数为单位计算。
5、 最小、最大开仓量。不同的平台,不同的货币对规定不同。
6、 智能交易。有些交易品种禁止使用 EA。
- #property copyright "Copyright 2012, laoyee"
- #property link "http://www.docin.com/yiwence"
- #property indicator_separate_window
- int init()
- {
- return(0);
- }
- int deinit()
- {
- ObjectsDeleteAll(WindowFind(WindowExpertName()),OBJ_LABEL);
- Comment("");
- return(0);
- }
- int start()
- {
- iMain();
- return(0);
- }
- void iMain()
- {
- iDisplayInfo("Author","作者: 老易(QQ:921795)",0,120,5,7,"",SeaGreen);
- //帐户信息
- iDisplayInfo("AccountInfo1","公司名称:"+AccountCompany(),0,10,20,8,"",SeaGreen);
- iDisplayInfo("AccountInfo2","杠杆比例:1:"+AccountLeverage(),0,10,35,8,"",SeaGreen);
- iDisplayInfo("AccountInfo3","帐户名称:"+AccountName(),0,10,50,8,"",SeaGreen);
- iDisplayInfo("AccountInfo4","帐户编号:"+AccountNumber(),0,10,65,8,"",SeaGreen);
- iDisplayInfo("AccountInfo5","服务器名:"+AccountServer(),0,10,80,8,"",SeaGreen);
- iDisplayInfo("AccountInfo6","停止水平:"+AccountStopoutLevel(),0,200,50,8,"",SeaGreen);
- //平台规则
- iDisplayInfo("PlatformRule1","交易点差:"+DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD),0),0,200,20,8,"",SeaGreen);
- iDisplayInfo("PlatformRule2","最小开仓:"+DoubleToStr(MarketInfo(Symbol(),MODE_MINLOT),2),0,200,65,8,"",SeaGreen);
- iDisplayInfo("PlatformRule3","最大开仓:"+DoubleToStr(MarketInfo(Symbol(),MODE_MAXLOT),2),0,200,80,8,"",SeaGreen);
- iDisplayInfo("PlatformRule4"," 单 点 价 值 :"+DoubleToStr(MarketInfo(Symbol(),MODE_MARGINREQUIRED),2),0,200,35,8,"",SeaGreen);
- if (MarketInfo(Symbol(),MODE_TRADEALLOWED)==1)
- {
- iDisplayInfo("PlatformRule5","智能交易:允许",0,200,95,8,"",SeaGreen);
- }
- else iDisplayInfo("PlatformRule5","智能交易:禁止",0,200,95,8,"",SeaGreen);
- if (IsDemo())
- {
- iDisplayInfo("PlatformRule6","帐户类型:模拟",0,10,95,8,"",SeaGreen);
- }
- else iDisplayInfo("PlatformRule6","帐户类型:真实",0,10,95,8,"",SeaGreen);
- }
- void iDisplayInfo(string LableName,string LableDoc,int Corner,int LableX,int LableY,int DocSize,string DocStyle,color DocColor)
- {
- if (Corner == -1) return(0);
- int myWindowsHandle = WindowFind(WindowExpertName()); //获取当前指标名称所在窗口序号
- LableName=LableName+DoubleToStr(myWindowsHandle,0);
- ObjectCreate(LableName, OBJ_LABEL, myWindowsHandle, 0, 0); //建立标签对象
- ObjectSetText(LableName, LableDoc, DocSize, DocStyle,DocColor); //定义对象属性
- ObjectSet(LableName, OBJPROP_CORNER, Corner); //确定坐标原点,0-左上角,1-右上角,2-左下角,3-右下角,-1-不显示
- ObjectSet(LableName, OBJPROP_XDISTANCE, LableX); //定义横坐标,单位像素
- ObjectSet(LableName, OBJPROP_YDISTANCE, LableY); //定义纵坐标,单位像素
- }
|