### 内容目录

• 概述
• 点的概念
• 点值
• 点差成本
• 输出全部外汇货币对的点差成本
• 测试
• 结论

### 测试

1.  测试参数

• 平台：MT5
• 服务器：IMPACT-Demo
• 账户类型：美元账户、英镑账户
• 交易手数：1标准手
• 交易时段：亚洲时段或点差平稳时段

2.  测试结果

1). 美元账户

货币对    计算时的当前点差实际交易时的点差 计算得到的点差成本  实际交易时的点差成本
EURUSD555.00(USD/1 lot)5.00(USD/1 lot)
EURGBP668.48(USD/1 lot)8.48(USD/1 lot)
XAUEUR575770.79(USD/1 lot)70.79(USD/1 lot)
EURHKD67678.57(USD/1 lot)8.57(USD/1 lot)

2). 英镑账户

货币对    计算时的当前点差实际交易时的点差 计算得到的点差成本  实际交易时的点差成本
EURUSD664.24(GBP/1 lot)4.24(GBP/1 lot)
EURGBP999.00(GBP/1 lot)9.00(GBP/1 lot)
XAUEUR575750.09(GBP/1 lot)50.09(GBP/1 lot)
EURHKD67676.07(GBP/1 lot)6.07(GBP/1 lot)

3.  测试EA代码

```//+------------------------------------------------------------------+
//|                                      Copyright 2017, Yupeng Xiao |
//|                                                  shaw_yp@126.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Global var                                                       |
//+------------------------------------------------------------------+
const double TestLots = 1.0;
int g_totalnum = 5;
double g_cost_output[5];//putput cost
double g_cost_test[5];  //test cost by trade
int OnInit()
{
PrintInfo();
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
void PrintInfo()
{
string AccountCurrency = "USD";
for(int i=0;i<g_totalnum;i++)
{
AccountCurrency = AccountInfoString(ACCOUNT_CURRENCY);
", OutputCost is:",DoubleToString(g_cost_output[i],2),"(",AccountCurrency,"), TestCost is:",
DoubleToString(g_cost_test[i],2),"(",AccountCurrency,")!!");
}

return;
}
//+------------------------------------------------------------------+
//| Trade get test cost                                              |
//+------------------------------------------------------------------+
{
MqlTick latest_price;

for(int i = 0; i < g_totalnum; i++)
{

PositionSelect(g_symbols[i]);
g_cost_test[i] = MathAbs(PositionGetDouble(POSITION_PROFIT));