2016年1月26日火曜日

EA清水寺時間別設定 恐れていた結果が...

さて前回の最適化結果を踏まえてEA化しました。
仮称EABandHoursさて実力はいかに!!

気になっていた勝率ですが、
EA清水寺  売62%買52%
BandHours 売54%買56%
ちょっと落ちていますが予想ほどひどくありません。

最大ドローダウン
EA清水寺 98,180 予想 29,441 BandHours 27,491
いいですねー

そして、損益は
EA清水寺 2,208,900
予想    1,019,698
BandHours  1,370,65
あれ?一桁足りない!!!!
時間が変わった時に残っていたポジションが影響しているのでしょうか
どうやら没です。






#property copyright "Copyright 2016/1/26,TACA"
#property link      "http://mt4kyoto.blogspot.jp/"
#define MAGIC 20160126
extern int BandUpP = 20;  
extern int BandDownP = 20;
double TSProfitU[24] ={170,160,150,150,150,160,160,200,170,180,180,170,180,220,170,160,150,250,250,190,160,160,230,180};
double TSProfitD[24] ={220,250,170,150,150,150,160,150,160,180,180,190,250,160,180,160,170,150,150,220,220,180,250,230};
double ProfitU[24]   ={ 60,130,130, 70, 70,150,140,130, 60, 90, 80, 50,110, 90, 70, 50,130,150,100, 90, 50, 90, 70,110};
double ProfitD[24]   ={ 90, 90, 80,150,150,100, 70,140,140,110, 80,140, 70, 60,140,150,100, 50,100,100,120, 50, 60,110};
double TSMaxRange = 0 ;
double StopLossU[24] ={140,200,200,100,150,100,180,100,110,130,190,190,160,120,120,110,150,140,120,190,200,170,200,200};
double StopLossD[24] ={180,120,140,130,120,100,100,190,190,190,160,170,150,180,170,170,160,200,190,150,150,200,200,180};
extern int Hours=0;
extern int Spread =4 ;
extern double Lots = 0.01;          
string Comments = "Bands USDJPY m1"; // Comments
datetime TimeOld;
int Ticket = 0;
int d;
int init()
{TimeOld = Time[0];TSMaxRange = Close[0];
if (OrderSelect(0,SELECT_BY_POS) == 1)
   {if (OrderComment() == Comments){Ticket = OrderTicket();}}
return(0);}
int start()
{if (Time[0] != TimeOld){TimeOld = Time[0];
if (OrdersTotal() == 0){Ticket = 0;}
if (Ticket <=0){TSMaxRange = Close[0];}
if(OrderSelect(Ticket,SELECT_BY_TICKET) == True)
{if(OrderType()==0)
   {if (TSMaxRange < Close[0]){TSMaxRange = Close[0];}
    if (TSMaxRange - TSProfitU[Hour()] * Point > Close[0]){Exit();}
    else  if(OrderOpenPrice() - StopLossU[Hour()] * Point > Close[0]){Exit();}
          else if(OrderOpenPrice()+ProfitU[Hour()]*Point < Close[0]){Exit();}
   Comment("Long");}
else
   {if (TSMaxRange > Close[0]){TSMaxRange = Close[0];}
    if (TSMaxRange + TSProfitD[Hour()] * Point < Close[0]){Exit();}
    else  if(OrderOpenPrice() + StopLossD[Hour()] *Point < Close[0]){Exit();}
          else if(OrderOpenPrice()-ProfitD[Hour()]*Point > Close[0]){Exit();}
   Comment("Short");}
}  
   if( TBandUp(2,2) >= Close[2] && TBandUp(2,1) < Close[1] ){EntryShort();}
   if( TBandDown(2,2) <= Close[2] && TBandDown(2,1) > Close[1] ){EntryLong();}    

}  
return(0);}
int Exit()
{if (OrderClose(Ticket,Lots,OrderClosePrice(),5,Blue) == 1){Ticket = 0 ;}
   else{Exit();}
return(0);}
int EntryLong()
{if (Ticket <= 0 && MarketInfo(Symbol(),MODE_SPREAD) <= Spread)
{Ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,5,Ask - StopLossD[Hour()] * Point,0,Comments,MAGIC,0,Red);}
return(0);}
int EntryShort()
{if (Ticket <= 0 && MarketInfo(Symbol(),MODE_SPREAD) <= Spread)
{Ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,5,Bid + StopLossU[Hour()] * Point,0,Comments,MAGIC,0,Blue);}
return(0);}
double TBandDown(double Dev,int Shift){return(iBands(NULL,0,BandDownP,Dev,0,0,2,Shift));}
double TBandUp(double Dev,int Shift){return(iBands(NULL,0,BandUpP,Dev,0,0,1,Shift));}

0 件のコメント:

コメントを投稿