保证金占用公式: 当前报价 * 合约大小 * 手数 * 每点价值 * 杠杆比例
ENUM_SYMBOL_INFO_DOUBLE
属性 | 说明 | |
---|---|---|
SYMBOL_ASK | 当前做多(Buy)方向报价 | |
SYMBOL_ASKHIGH | 当日做多(Buy)方向最高报价 | |
SYMBOL_ASKLOW | 当日做多(Buy)方向最低报价 | |
SYMBOL_BID | 当前做空(Sell)方向报价 | |
SYMBOL_BIDHIGH | 当日做空(Sell)方向最高报价 | |
SYMBOL_BIDLOW | 当日做多(Sell)方向最低报价 | |
SYMBOL_LAST | 最后订单收盘价格 | |
SYMBOL_LASTHIGH | 最后订单最高价 | |
SYMBOL_LASTLOW | 最后订单最低价 | |
SYMBOL_POINT | 最小报价单位 | |
SYMBOL_TRADE_TICK_VALUE | 每点价值 | |
SYMBOL_TRADE_TICK_VALUE_PROFIT | 盈利方向每点价值 | |
SYMBOL_TRADE_TICK_VALUE_LOSS | 亏损方向每点价值 | |
SYMBOL_TRADE_TICK_SIZE | 最小报价大小 | |
SYMBOL_TRADE_CONTRACT_SIZE | 货币兑1手合约大小 | |
SYMBOL_SWAP_LONG | 做多(Buy)手续费 | |
SYMBOL_SWAP_SHORT | 做空(Sell)手续费 |
void OnStart()
{
// int symbol = Symbol();
string symbol = _Symbol;
printf("当前货币对: %s",symbol);
// 获得货币对的小数点位数
int digits = _Digits; // 获得当前图标的小数点位数
// int digits = SymbolInfoInteger(symbol,SYMBOL_DIGITS); // 获取指定图表的小数点位数
// 当前做多价格
double ask = SymbolInfoDouble(symbol,SYMBOL_ASK);
double ask_high = SymbolInfoDouble(symbol,SYMBOL_ASKHIGH);
double ask_low = SymbolInfoDouble(symbol,SYMBOL_ASKLOW);
printf("当前做多价格: %.5f,当天最高做多价: %.5f, 当天最低做多价: %.5f",
ask,ask_high,ask_low);
// 当前做空价格
double bid = SymbolInfoDouble(symbol,SYMBOL_BID);
double bid_high = SymbolInfoDouble(symbol,SYMBOL_BIDHIGH);
double bid_low = SymbolInfoDouble(symbol,SYMBOL_BIDLOW);
printf("当前做空价格: %.5f,当天最高做空价: %.5f, 当天最低做空价: %.5f",
bid,bid_high,bid_low);
// 最后订单信息
double last = SymbolInfoDouble(symbol,SYMBOL_LAST);
double last_high = SymbolInfoDouble(symbol,SYMBOL_LASTHIGH);
double last_low = SymbolInfoDouble(symbol,SYMBOL_LASTLOW);
printf("最后订单收盘价格: %.5f,最后订单最高价: %.5f, 最后订单最低价: %.5f",
last,last_high,last_low);
// 最后订单成交量信息
double volume = SymbolInfoDouble(symbol,SYMBOL_VOLUME_REAL);
double volume_high = SymbolInfoDouble(symbol,SYMBOL_VOLUMEHIGH_REAL);
double volume_low = SymbolInfoDouble(symbol,SYMBOL_VOLUMELOW_REAL);
printf("最后订单成交量: %.5f,最后订单最高成交量: %.5f, 最后订单最低成交量: %.5f",
volume,volume_high,volume_low);
// 最小报价单位
double point = SymbolInfoDouble(symbol, SYMBOL_POINT);
double tick_value = SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE);
double tick_value_profit = SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE_PROFIT);
double tick_value_loss = SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE_LOSS);
printf("最小报价单位: %.5f, 每点价值: %.5f, 盈利方向每点价值: %.5f , 亏损方向每点价值: %.5f",
point,tick_value,tick_value_profit, tick_value_loss);
// 最小报价大小
double tick_size = SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_SIZE);
double contract_size = SymbolInfoDouble(symbol,SYMBOL_TRADE_CONTRACT_SIZE);
printf("最小报价大小: %.5f, 货币兑1手合约大小: %.5f, 盈利方向每点价值: %.5f , 亏损方向每点价值: %.5f",
tick_size,contract_size,tick_value_profit, tick_value_loss);
// 做多手续费 和 做空手续费
double buy_swap = SymbolInfoDouble(symbol,SYMBOL_SWAP_LONG);
double sell_swap = SymbolInfoDouble(symbol,SYMBOL_SWAP_SHORT);
printf("做多手续费: %+.2f, 做空手续费: %.f",
buy_swap,sell_swap);
// 股票 期货 相关的数据
double session_volume = SymbolInfoDouble(symbol,SYMBOL_SESSION_VOLUME);
double session_turnover = SymbolInfoDouble(symbol,SYMBOL_SESSION_TURNOVER);
double session_interest = SymbolInfoDouble(symbol,SYMBOL_SESSION_INTEREST);
double session_buy_orders_volume = SymbolInfoDouble(symbol,SYMBOL_SESSION_BUY_ORDERS_VOLUME);
double session_sell_orders_volume = SymbolInfoDouble(symbol,SYMBOL_SESSION_SELL_ORDERS_VOLUME);
double session_open = SymbolInfoDouble(symbol,SYMBOL_SESSION_OPEN);
double session_close = SymbolInfoDouble(symbol,SYMBOL_SESSION_CLOSE);
double session_aw = SymbolInfoDouble(symbol,SYMBOL_SESSION_AW);
double session_price_settlement = SymbolInfoDouble(symbol,SYMBOL_SESSION_PRICE_SETTLEMENT);
double session_price_limit_max = SymbolInfoDouble(symbol,SYMBOL_SESSION_PRICE_LIMIT_MAX);
double session_price_limit_min = SymbolInfoDouble(symbol,SYMBOL_SESSION_PRICE_LIMIT_MIN);
double margin_hedged = SymbolInfoDouble(symbol,SYMBOL_MARGIN_HEDGED);
double price_change = SymbolInfoDouble(symbol,SYMBOL_PRICE_CHANGE);
double price_volatility = SymbolInfoDouble(symbol,SYMBOL_PRICE_VOLATILITY);
printf("当前品种总交易量: %.5f, 当前品种的总流通量: %.5f, 总持仓利息: %.5f",
session_volume,
session_turnover,
session_interest
);
}