--------------------------------------------------------- 盈亏比2.2 最大资金回撤15% 和我在外汇-欧美测试结果惊人的相似。 但是一年才开单30多次,怕怕。。。。 不管怎么说,这个系统不怎么亏钱。。。。。。。。。。。 另外k=1.2 效果比较好
我的mt4系统,效果不好 extern double k = 1.1; int g_ticket_84; double trig; bool gi_96; void init() { if (true) { trig = k*MathMax(iHigh(NULL,PERIOD_D1,1)-iClose(NULL,PERIOD_D1,1),iClose(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1)); if (iClose(Symbol(), 0, 1) > (iOpen(NULL,PERIOD_D1,0)+trig)) { gi_96 = TRUE; g_ticket_84 = OrderSend(Symbol(), OP_BUY, 0.1, NormalizeDouble(Ask, Digits), 0, 0, 0, 0, 0, 0, Green); } else { if (iClose(Symbol(), 0, 1) < (iOpen(NULL,PERIOD_D1,0)-trig)) { gi_96 = FALSE; g_ticket_84 = OrderSend(Symbol(), OP_SELL, 0.1, NormalizeDouble(Bid, Digits), 0, 0, 0, 0, 0, 0, Green); } } } } int start() { if (gi_96 == FALSE) { if (iClose(Symbol(), 0, 1) > (iOpen(NULL,PERIOD_D1,0)+trig)) { gi_96 = TRUE; closeAll(); g_ticket_84 = OrderSend(Symbol(), OP_BUY, 0.1, NormalizeDouble(Ask, Digits), 0, 0, 0, 0, 0, 0, Green); } } else { if (iClose(Symbol(), 0, 1) < (iOpen(NULL,PERIOD_D1,0)-trig)) { gi_96 = FALSE; closeAll(); g_ticket_84 = OrderSend(Symbol(), OP_SELL, 0.1, NormalizeDouble(Bid, Digits), 0, 0, 0, 0, 0, 0, Red); } } return (0); } void closeAll() { while (OrdersTotal() > 0) { OrderSelect(0, SELECT_BY_POS); if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, 0, Blue); if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, 0, Blue); } }
--------------------------------------- 每天的开盘价 收盘价 每天的高点 低点 很好找到 当然因为服务器时间不同会有差异。 我是在fxdd的mt4平台上测试的。 附上ea源代码 仅供参考,谨慎实盘。 //+------------------------------------------------------------------+ //| dualthrust-1.mq4 | //| Copyright ?2009, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright ?2009, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #define MAGICMA 09000 //extern double TakeProfit = 30000; //止赢点数 //extern double StopLoss = 10000; //止损点数 extern double lots=0.1; //一次下单手数 extern double k=0.7; double SB_openbuy,SB_opensell; int res=0; bool BUYme=false; bool SELLme=false; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- for(int i=OrdersTotal(); i>=0; i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true) if ( OrderMagicNumber() != MAGICMA ) continue; if(OrderSymbol()!=Symbol()) continue; { if(OrderType()==OP_BUY ) {SB_openbuy++;} if( OrderType()==OP_SELL) {SB_opensell++;} } } //----- //---------- double rates[1][6],yesterday_close,yesterday_high,yesterday_low,today_open; ArrayCopyRates(rates, Symbol(), PERIOD_D1); if(DayOfWeek() == 1) { if(TimeDayOfWeek(iTime(Symbol(),PERIOD_D1,1)) == 5) { yesterday_close = rates[1][4]; yesterday_high = rates[1][3]; yesterday_low = rates[1][2]; today_open = iOpen(NULL,PERIOD_D1,0); } else { for(int d = 5;d>=0;d--) { if(TimeDayOfWeek(iTime(Symbol(),PERIOD_D1,d)) == 5) { yesterday_close = rates[d][4]; yesterday_high = rates[d][3]; yesterday_low = rates[d][2]; today_open = iOpen(NULL,PERIOD_D1,0); } } } } else { yesterday_close = rates[1][4]; yesterday_high = rates[1][3]; yesterday_low = rates[1][2]; today_open = iOpen(NULL,PERIOD_D1,0); } double yesterdayhc; double yesterdaycl; double yesterdayabs; yesterdayhc=MathAbs(yesterday_high -yesterday_close)/Point; yesterdaycl=MathAbs(yesterday_close-yesterday_low)/Point; if(yesterdayhc>= yesterdaycl){yesterdayabs=yesterdayhc*k;} if(yesterdayhc< yesterdaycl){yesterdayabs=yesterdaycl*k;} if(Close[0]>(today_open+yesterdayabs*Point)){BUYme=true;} if(Close[0]<(today_open-yesterdayabs*Point)){SELLme=true;} //---------------------------------------- if(SB_openbuy==0){Open_Oderbuy();} if(SB_opensell==0){Open_Odersell();} if(SB_openbuy==1){Pips();} if(SB_opensell==1){Pips();} //---- SB_openbuy=0;SB_opensell=0;BUYme=false;SELLme=false; //---- return(0); } //+------------------------------------------------------------------+ void Open_Oderbuy() { if(BUYme==true) { res=OrderSend(Symbol(),OP_BUY,lots,Ask,100,0,0,"",MAGICMA,0,Blue) ; } } /////// void Open_Odersell() { if(SELLme==true) { res=OrderSend(Symbol(),OP_SELL,lots,Bid,100,0,0,"",MAGICMA,0,Blue) ; } } // // void Pips() { for(int e=OrdersTotal();e>=0;e--) { if (OrderSelect(e,SELECT_BY_POS,MODE_TRADES)==true) if ( OrderMagicNumber() != MAGICMA ) continue; if(OrderSymbol()!=Symbol()) continue; { if (OrderType()==OP_BUY ) { if(SELLme==true) {OrderClose(OrderTicket(),OrderLots(),Bid,100,Red);} } if(OrderType()==OP_SELL) { if(BUYme==true) {OrderClose(OrderTicket(),OrderLots(),Ask,100,Red);} } } } } ------------------------------------------------------------------
我来贴一下wld版本的大家看看对不对 我来贴一下wld版本的大家看看对不对 var k, index, lser, hser: float; var HH, LL, Bar, p: integer; k := 1; HH := createseries; LL := createseries; for Bar := 3 to BarCount - 1 do begin index := k * Max(abs( pricehigh(bar-1) - priceclose(bar-1) ), abs( (priceclose(bar-1)- pricelow(bar-1) ))); if LastPositionActive then begin p := LastPosition; hser := Priceopen( bar ) + index; lser := Priceopen( bar ) - index; setseriesvalue(bar, HH, hser); setseriesvalue(bar, LL, lser); if PositionLong( p ) then begin SellAtStop( Bar , Priceopen( bar ) - index, p, '0' ); ShortAtStop( Bar , Priceopen( bar ) - index, '2' ); end; if PositionShort( p ) then begin BuyAtStop( Bar , Priceopen( bar ) + index, '0' ); CoverAtStop( Bar , Priceopen( bar ) + index, p, '2' ); end; end; if not LastPositionActive then begin BuyAtStop( Bar , Priceopen( bar ) + index, '0' ); ShortAtStop( Bar , Priceopen( bar ) - index, '2' ); end; end; plotseries(HH, 0, 800, #thin); plotseries(LL, 0, 008, #thin); 另外我看这个系统在执行时如果有较大的滑点会出大问题。国内期货我搞不明白怎么自动交易,如果人工交易,恐怕也能把人累死 呵呵