// 方法一:从交易品种属性获得点差
- bool spreadfloat=SymbolInfoInteger(Symbol(),SYMBOL_SPREAD_FLOAT);
- string comm=StringFormat(" %s点差 = %I64d 点\r\n", spreadfloat?"浮动":"固定", SymbolInfoInteger(Symbol(),SYMBOL_SPREAD));
复制代码
// 方法二:计算点差
- double ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
- double bid=SymbolInfoDouble(Symbol(),SYMBOL_BID);
- double spread=ask-bid;
- int spread_points=(int)MathRound(spread/SymbolInfoDouble(Symbol(),SYMBOL_POINT));
- comm=comm+"点差 = "+(string)spread_points+" 点";
- Comment(comm);
复制代码
|