|
说明:这个EA建立在TD指标上,大意是在出现完善TD买入结构时开多单。 //+------------------------------------------------------------------+ //| 1EA-TD.mq4 | //| Copyright 2017, metaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2017, metaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict extern color Setup=MediumSpringGreen; extern color Countdown=Gold; extern int NumBars=1000; extern int Space=50; double Support[], Resistance[], bPerfected[], sPerfected[], Buy[], Sell[]; extern int magic=12345; datetime buytime=0; extern double 下单量=0.1; extern int 止损点数=100; extern int 止盈点数=500; //+------------------------------------------------------------------+ int onInit() { return(INIT_SUCCEEDED); } void onDeinit(const int reason) { for(int i=0;i<Bars;i++) { ObjectDelete(""+i); ObjectDelete("cd"+i); } } void onTick() { int counted_bars=IndicatorCounted(); int bSetup, sSetup, bCountdown, sCountdown; int x; double tfm=Space*Point; double CountTest; bool bSetupInd, sSetupInd, bPerfect, sPerfect; for(int i=0; i<=1000; i++) { ObjectDelete(""+i); ObjectDelete("cd"+i); if(Close<=Close[i+4] && Close[i+1]>=Close[i+5] && bSetup==0)//start setup { bSetup++; ObjectCreate(""+i,OBJ_TEXT,0,Time,Low-tfm); ObjectSetText(""+i,""+bSetup,8,"Arial",Setup); } if(Close<Close[i+4] && bSetup!=0 && ObjectFind(""+i)==-1) { bSetup++; if(bSetup==9) { OrderSend(Symbol(),OP_BUY,0.1,Ask,0,0,0,0,magic,0,clrRed); ObjectCreate(""+i,OBJ_TEXT,0,Time,Low-tfm); ObjectSetText(""+i,""+bSetup,10,"Arial Black",Setup); bSetup=0; bSetupInd=true; sSetupInd=false; sCountdown=0; Print(""+GetLastError()); } else { ObjectCreate(""+i,OBJ_TEXT,0,Time,Low-tfm); ObjectSetText(""+i,""+bSetup,8,"Arial",Setup); } } //Deletes numbers that were created if there is a break in sequence before 9 is reached else if(Close>=Close[i+4] && bSetup!=0) { for(x=i+1; x<=i+bSetup+1; x++) ObjectDelete(""+x); bSetup=0; } } 回测提示错误如下,有两个,一个是分母有为0的情况,一个是数组超限了,请问如何修改: Testing pass stopped due to a critica error in the EA array out of range in 'EA.mq4'(54,26) |
[求助]EA回测提示错误修改
回复:0 浏览:127
- 楼主admin 圈主
- 2019-05-05 12:31