|
测试发现,MT4 EMA的计算值与理论值有差别,是否会导致错误的交易信号?
1. 测试代码
//*----------测试EMA理论值和实际值
//*-------打印最新的3根柱子的开盘价
int i;
for(i=0; i<3; i++)
{
Print("Open[" + i + "] = " + Open);
}
//-------*/
//EMA的理论计算值
double EMValue;
EMValue = Open[0]*3/6 + Open[1]*2/6 + Open[2]*1/6;
Print("EMA理论值 = " + EMValue);
//EMA实际运算值
int Trx_Prd = 3;
EMValue=iMA(NULL,0,Trx_Prd,0,MODE_EMA,PRICE_OPEN,0);
Print("EMA实际值 = " + EMValue);
return(0);
//-------*/
2. EMA计算错误:
输出值为:
2013.09.22 09:49:43 2013.09.11 23:33 For_Test EURUSD,M1: EMA实际值 = 1.33178695
2013.09.22 09:49:43 2013.09.11 23:33 For_Test EURUSD,M1: EMA理论值 = 1.33177833
2013.09.22 09:49:43 2013.09.11 23:33 For_Test EURUSD,M1: Open[2] = 1.33179000
2013.09.22 09:49:43 2013.09.11 23:33 For_Test EURUSD,M1: Open[1] = 1.33171000
2013.09.22 09:49:43 2013.09.11 23:33 For_Test EURUSD,M1: Open[0] = 1.33182000
3.运行环境:
MT4版本: v4,build 509,24,jun 2013,
borker:MBT 真实帐户 backtesting |
|