スポンサーサイト

上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。
スポンサー広告 | CM(-) | --/--/--(--) --:--

JK_Carry_Trade_EA_1.168.mq4

JK_Carry_Trade_EA_1.168.mq4の変更点

Lots ManagementとRisk Managementについて変更しています。

具体的には、リスクを低下させるためにAccount BalanceからLotsを算出するようにしました。

その他に、複数のポジションを保有している場合、TakeProfitを平均化するように変更しました。

また、エントリーのタイミングをチェックする方法を3パターンにして、長期的な円高に対応させました。


JK_Carry_Trade_EA_1.168.mq4のバックテスト結果

シングルチェック

(クリックで拡大)


ダブルチェック

(クリックで拡大)


トリプルチェック

(クリックで拡大)


シングルチェックが従来の方法(1本のRCIで底チェック)です。

トリプルチェック(3本のRCIで底チェック)になると最終利益が大分変わるのが分かると思います。

底チェックの判定を厳しくすることにより、ドローダウン(強制ロスカット)の抑止を可能としています。

長期的な円高時はダブルチェックまたはトリプルチェックを設定し、通常時はシングルチェックにするという具合で使用します。


JK_Carry_Trade_EA_1.168.mq4:MQL4プログラムソース

//+------------------------------------------------------------------+
//|                                      JK_Carry_Trade_EA_1.168.mq4 |
//|                                     Copyright (c) 2007, 人生解放 |
//|                                http://winnerlife.blog35.fc2.com/ |
//+------------------------------------------------------------------+
/*
設計&仕様書
1.AccountBalanceによってLotsを変化させてRisk Managementをする。
2.RCIの数値で逆張りしながら底をつくまで最大20回ナンピンする。
3.ナンピンしたらTakeProfitを平均化する。
4.スワップを受け取ったら、その分TakeProfitを引き下げる。
5.RCIを過去3本の値まで確認できるようにする。
1.0-----底で円売りするための逆張りロジックを完成
1.1-----TakeProfitにFibonacci Retracementを応用
1.12----底確認のロジックを少し変更
1.13----Position SizingのSystemを導入
1.14----Lotsの制御Systemを導入
1.15----Entryの仕組みを変更
1.16----あらゆる数値にFibonacci数を用いるように変更
1.168---TakeProfitを平均化するように変更
*/
#property copyright "Copyright (c) 2007, 人生解放"
#property link      "http://winnerlife.blog35.fc2.com/"
//---- Input Parameters
extern string Warning0 = "MagicNumberの設定";
extern int MagicNumber1 = 101;
extern int MagicNumber2 = 102;
extern int MagicNumber3 = 103;
extern int MagicNumber4 = 104;
extern int MagicNumber5 = 105;
extern int MagicNumber6 = 106;
extern int MagicNumber7 = 107;
extern int MagicNumber8 = 108;
extern int MagicNumber9 = 109;
extern int MagicNumber10 = 110;
extern int MagicNumber11 = 111;
extern int MagicNumber12 = 112;
extern int MagicNumber13 = 133;
extern int MagicNumber14 = 114;
extern int MagicNumber15 = 115;
extern int MagicNumber16 = 116;
extern int MagicNumber17 = 117;
extern int MagicNumber18 = 118;
extern int MagicNumber19 = 119;
extern int MagicNumber20 = 120;
extern string Warning1 = "スワップを受け取った後の注文可能な時間を指定";
extern int OrderModifyTime = 0;
extern string Warning2 = "Lotの設定";
extern double Lots1 = 0.1;
extern double Lots2 = 0.1;
extern double Lots3 = 0.1;
extern double Lots4 = 0.1;
extern double Lots5 = 0.1;
extern double Lots6 = 0.2;
extern double Lots7 = 0.2;
extern double Lots8 = 0.2;
extern double Lots9 = 0.2;
extern double Lots10 = 0.2;
extern double Lots11 = 0.3;
extern double Lots12 = 0.3;
extern double Lots13 = 0.3;
extern double Lots14 = 0.3;
extern double Lots15 = 0.3;
extern double Lots16 = 0.4;
extern double Lots17 = 0.4;
extern double Lots18 = 0.4;
extern double Lots19 = 0.4;
extern double Lots20 = 0.4;
extern string Warning3 = "Fibonacci Retracementを適用するH1の範囲をBar数で指定";
extern int CalBars_H1 = 89;
extern string Warning4 = "TakeProfitを指定するためのFibonacci Retracement";
/*extern double Fibo_Re1 = 0.236;
extern double Fibo_Re2 = 0.286;
extern double Fibo_Re3 = 0.336;
extern double Fibo_Re4 = 0.386;
extern double Fibo_Re5 = 0.436;
extern double Fibo_Re6 = 0.486;
extern double Fibo_Re7 = 0.536;
extern double Fibo_Re8 = 0.586;
extern double Fibo_Re9 = 0.636;
extern double Fibo_Re10 = 0.686;
extern double Fibo_Re11 = 0.736;
extern double Fibo_Re12 = 0.786;
extern double Fibo_Re13 = 0.836;
extern double Fibo_Re14 = 0.886;
extern double Fibo_Re15 = 0.936;
extern double Fibo_Re16 = 0.986;
extern double Fibo_Re17 = 1.036;
extern double Fibo_Re18 = 1.086;
extern double Fibo_Re19 = 1.136;
extern double Fibo_Re20 = 1.186;
*/extern double Fibo_Re1 = 0.50;
extern double Fibo_Re2 = 0.51;
extern double Fibo_Re3 = 0.52;
extern double Fibo_Re4 = 0.53;
extern double Fibo_Re5 = 0.54;
extern double Fibo_Re6 = 0.55;
extern double Fibo_Re7 = 0.56;
extern double Fibo_Re8 = 0.57;
extern double Fibo_Re9 = 0.58;
extern double Fibo_Re10 = 0.59;
extern double Fibo_Re11 = 0.60;
extern double Fibo_Re12 = 0.61;
extern double Fibo_Re13 = 0.62;
extern double Fibo_Re14 = 0.63;
extern double Fibo_Re15 = 0.64;
extern double Fibo_Re16 = 0.65;
extern double Fibo_Re17 = 0.66;
extern double Fibo_Re18 = 0.67;
extern double Fibo_Re19 = 0.68;
extern double Fibo_Re20 = 0.69;
extern string Warning5 = "1日に切り下げるTakeProfitのPoint";
extern double Swap1dayPoint = 1;
extern double TakeProfit;
extern string Warning6 = "資産Management";
extern double FreeMargin = 10000;
extern double Leverage = 2;
extern int    Slippage = 3;
extern string Warning7 = "TrailingStopの設定";
extern double TrailingStopStart = 15;
extern int RCIBars = 89;
extern int KahenRCIBars = 55;
extern int WaitTimeHour = 3;
extern double BuyLevel1 = 0.850;
extern double BuyLevel2 = 0.855;
extern double BuyLevel3 = 0.860;
extern double BuyLevel4 = 0.865;
extern double BuyLevel5 = 0.870;
extern double BuyLevel6 = 0.875;
extern double BuyLevel7 = 0.880;
extern double BuyLevel8 = 0.885;
extern double BuyLevel9 = 0.890;
extern double BuyLevel10 = 0.895;
extern double BuyLevel11 = 0.900;
extern double BuyLevel12 = 0.905;
extern double BuyLevel13 = 0.910;
extern double BuyLevel14 = 0.915;
extern double BuyLevel15 = 0.920;
extern double BuyLevel16 = 0.925;
extern double BuyLevel17 = 0.930;
extern double BuyLevel18 = 0.935;
extern double BuyLevel19 = 0.940;
extern double BuyLevel20 = 0.945;
extern bool AutoRCI = false;
extern bool LotsManagement = true;
extern bool DoubleCheck = true;
extern bool TripleCheck = false;
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start(){
//----
 CalculatedLots();
 NewOrderSend();
 NewOrderTakeProfit();
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Risk Management                                                  |
//+------------------------------------------------------------------+
void CalculatedLots(){
 double AllLots = Lots1+Lots2+Lots3+Lots4+Lots5+Lots6+Lots7+Lots8+Lots9+Lots10+Lots11+Lots12+Lots13+Lots14+Lots15+Lots16+Lots17+Lots18+Lots19+Lots20;
 double NewFreeMargin = AccountBalance() / (AllLots);
 if(NewFreeMargin > FreeMargin){
  Lots1=Lots1+0.1;Lots2=Lots2+0.1;Lots3=Lots3+0.1;Lots4=Lots4+0.1;Lots5=Lots5+0.1;
  Lots6=Lots6+0.1;Lots7=Lots7+0.1;Lots8=Lots8+0.1;Lots9=Lots9+0.1;Lots10=Lots10+0.1;
  Lots11=Lots11+0.1;Lots12=Lots12+0.1;Lots13=Lots13+0.1;Lots14=Lots14+0.1;Lots15=Lots15+0.1;
  Lots16=Lots16+0.1;Lots17=Lots17+0.1;Lots18=Lots18+0.1;Lots19=Lots19+0.1;Lots20=Lots20+0.1;
 }
}
//+------------------------------------------------------------------+
//| Open Order                                                       |
//+------------------------------------------------------------------+
void NewOrderSend(){
//---- RCI
 int rangeN = RCIBars;
 if(AutoRCI == true){
  int UP = 0, DN = 0;
  for(int j = KahenRCIBars; j > 1; j--){
   double RCI4 = iCustom(NULL,0,"SpearmanRankCorr",rangeN,0,j);
   if(RCI4 > 0.00) UP++;
   if(RCI4 < 0.00) DN++;
  }
 rangeN = RCIBars - UP + DN;
 }
 double RCI1 = iCustom(NULL,0,"SpearmanRankCorr",rangeN,0,0);
 if(DoubleCheck == true) double RCI2 = iCustom(NULL,0,"SpearmanRankCorr",rangeN,0,1);
 else RCI2 = -1;
 if(TripleCheck == true) double RCI3 = iCustom(NULL,0,"SpearmanRankCorr",rangeN,0,2);
 else RCI3 = -1;
//---- Buy
 double Highest1 = iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, CalBars_H1, 0));
 double Lowest1 = iLow(NULL, PERIOD_H1, iLowest(NULL, PERIOD_H1, MODE_LOW, CalBars_H1, 0));

 if(OrdersTotal() == 0 && RCI1 < -BuyLevel1 && RCI2 < -BuyLevel1 && RCI3 < -BuyLevel1){
  TakeProfit = (Highest1-Lowest1)*Fibo_Re1;
  OrderSend(Symbol(),OP_BUY,Lots1,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber1,0,Red);
  return(0);
 }
 if(OrdersTotal() == 1 && RCI1 < -BuyLevel2 && RCI2 < -BuyLevel2 && RCI3 < -BuyLevel2){
  OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re2;
  OrderSend(Symbol(),OP_BUY,Lots2,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber2,0,Blue);
  return(0);
 }
 if(OrdersTotal() == 2 && RCI1 < -BuyLevel3 && RCI2 < -BuyLevel3 && RCI3 < -BuyLevel3){
  OrderSelect(1,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re3;
  OrderSend(Symbol(),OP_BUY,Lots3,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber3,0,Yellow);
  return(0);
 }
 if(OrdersTotal() == 3 && RCI1 < -BuyLevel4 && RCI2 < -BuyLevel4 && RCI3 < -BuyLevel4){
  OrderSelect(2,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re4;
  OrderSend(Symbol(),OP_BUY,Lots4,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber4,0,Lime);
  return(0);
 }
 if(OrdersTotal() == 4 && RCI1 < -BuyLevel5 && RCI2 < -BuyLevel5 && RCI3 < -BuyLevel5){
  OrderSelect(3,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re5;
  OrderSend(Symbol(),OP_BUY,Lots5,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber5,0,Orange);
  return(0);
 }
 if(OrdersTotal() == 5 && RCI1 < -BuyLevel6 && RCI2 < -BuyLevel6 && RCI3 < -BuyLevel6){
  OrderSelect(4,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re6;
  OrderSend(Symbol(),OP_BUY,Lots6,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber6,0,Gold);
  return(0);
 }
 if(OrdersTotal() == 6 && RCI1 < -BuyLevel7 && RCI2 < -BuyLevel7 && RCI3 < -BuyLevel7){
  OrderSelect(5,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re7;
  OrderSend(Symbol(),OP_BUY,Lots7,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber7,0,Gray);
  return(0);
 }
 if(OrdersTotal() == 7 && RCI1 < -BuyLevel8 && RCI2 < -BuyLevel8 && RCI3 < -BuyLevel8){
  OrderSelect(6,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re8;
  OrderSend(Symbol(),OP_BUY,Lots8,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber8,0,Pink);
  return(0);
 }
 if(OrdersTotal() == 8 && RCI1 < -BuyLevel9 && RCI2 < -BuyLevel9 && RCI3 < -BuyLevel9){
  OrderSelect(7,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re9;
  OrderSend(Symbol(),OP_BUY,Lots9,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber9,0,Brown);
  return(0);
 }
 if(OrdersTotal() == 9 && RCI1 < -BuyLevel10 && RCI2 < -BuyLevel10 && RCI3 < -BuyLevel10){
  OrderSelect(8,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re10;
  OrderSend(Symbol(),OP_BUY,Lots10,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber10,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 10 && RCI1 < -BuyLevel11 && RCI2 < -BuyLevel11 && RCI3 < -BuyLevel11){
  OrderSelect(9,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re11;
  OrderSend(Symbol(),OP_BUY,Lots11,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber11,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 11 && RCI1 < -BuyLevel12 && RCI2 < -BuyLevel12 && RCI3 < -BuyLevel12){
  OrderSelect(10,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re12;
  OrderSend(Symbol(),OP_BUY,Lots12,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber12,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 12 && RCI1 < -BuyLevel13 && RCI2 < -BuyLevel13 && RCI3 < -BuyLevel13){
  OrderSelect(11,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re13;
  OrderSend(Symbol(),OP_BUY,Lots13,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber13,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 13 && RCI1 < -BuyLevel14 && RCI2 < -BuyLevel14 && RCI3 < -BuyLevel14){
  OrderSelect(12,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re14;
  OrderSend(Symbol(),OP_BUY,Lots14,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber14,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 14 && RCI1 < -BuyLevel15 && RCI2 < -BuyLevel15 && RCI3 < -BuyLevel15){
  OrderSelect(13,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re15;
  OrderSend(Symbol(),OP_BUY,Lots15,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber15,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 15 && RCI1 < -BuyLevel16 && RCI2 < -BuyLevel16 && RCI3 < -BuyLevel16){
  OrderSelect(14,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re16;
  OrderSend(Symbol(),OP_BUY,Lots16,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber16,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 16 && RCI1 < -BuyLevel17 && RCI2 < -BuyLevel17 && RCI3 < -BuyLevel17){
  OrderSelect(15,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re17;
  OrderSend(Symbol(),OP_BUY,Lots17,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber17,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 17 && RCI1 < -BuyLevel18 && RCI2 < -BuyLevel18 && RCI3 < -BuyLevel18){
  OrderSelect(16,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re18;
  OrderSend(Symbol(),OP_BUY,Lots18,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber18,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 18 && RCI1 < -BuyLevel19 && RCI2 < -BuyLevel19 && RCI3 < -BuyLevel19){
  OrderSelect(17,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re19;
  OrderSend(Symbol(),OP_BUY,Lots19,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber19,0,DeepPink);
  return(0);
 }
 if(OrdersTotal() == 19 && RCI1 < -BuyLevel20 && RCI2 < -BuyLevel20 && RCI3 < -BuyLevel20){
  OrderSelect(18,SELECT_BY_POS,MODE_TRADES);
  if(OrderOpenTime()+60*60*WaitTimeHour >= TimeCurrent()) return(0);
  TakeProfit = (Highest1-Lowest1)*Fibo_Re20;
  OrderSend(Symbol(),OP_BUY,Lots20,Ask,Slippage,0,Ask+TakeProfit,"",MagicNumber20,0,DeepPink);
  return(0);
 }
}
//+------------------------------------------------------------------+
//| TakeProfit Managemet & OrderModify                               |
//+------------------------------------------------------------------+
void NewOrderTakeProfit(){
 if(LotsManagement == true){
  for(int k = 0; k < OrdersTotal(); k++){
   if(OrderSelect(k,SELECT_BY_POS,MODE_TRADES) == false) break;
   if(OrderMagicNumber() == MagicNumber1){
    double Number1TakeProfit = OrderTakeProfit()*OrderLots();
    double Number1OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber2){
    double Number2TakeProfit = OrderTakeProfit()*OrderLots();
    double Number2OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber3){
    double Number3TakeProfit = OrderTakeProfit()*OrderLots();
    double Number3OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber4){
    double Number4TakeProfit = OrderTakeProfit()*OrderLots();
    double Number4OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber5){
    double Number5TakeProfit = OrderTakeProfit()*OrderLots();
    double Number5OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber6){
    double Number6TakeProfit = OrderTakeProfit()*OrderLots();
    double Number6OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber7){
    double Number7TakeProfit = OrderTakeProfit()*OrderLots();
    double Number7OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber8){
    double Number8TakeProfit = OrderTakeProfit()*OrderLots();
    double Number8OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber9){
    double Number9TakeProfit = OrderTakeProfit()*OrderLots();
    double Number9OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber10){
    double Number10TakeProfit = OrderTakeProfit()*OrderLots();
    double Number10OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber11){
    double Number11TakeProfit = OrderTakeProfit()*OrderLots();
    double Number11OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber12){
    double Number12TakeProfit = OrderTakeProfit()*OrderLots();
    double Number12OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber13){
    double Number13TakeProfit = OrderTakeProfit()*OrderLots();
    double Number13OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber14){
    double Number14TakeProfit = OrderTakeProfit()*OrderLots();
    double Number14OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber15){
    double Number15TakeProfit = OrderTakeProfit()*OrderLots();
    double Number15OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber16){
    double Number16TakeProfit = OrderTakeProfit()*OrderLots();
    double Number16OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber17){
    double Number17TakeProfit = OrderTakeProfit()*OrderLots();
    double Number17OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber18){
    double Number18TakeProfit = OrderTakeProfit()*OrderLots();
    double Number18OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber19){
    double Number19TakeProfit = OrderTakeProfit()*OrderLots();
    double Number19OrderLots = OrderLots();
   }
   if(OrderMagicNumber() == MagicNumber20){
    double Number20TakeProfit = OrderTakeProfit()*OrderLots();
    double Number20OrderLots = OrderLots();
   }
   double NowOrderTakeProfit = (Number1TakeProfit+Number2TakeProfit+Number3TakeProfit+Number4TakeProfit+
                                Number5TakeProfit+Number6TakeProfit+Number7TakeProfit+Number8TakeProfit+
                                Number9TakeProfit+Number10TakeProfit+Number11TakeProfit+Number12TakeProfit+
                                Number13TakeProfit+Number14TakeProfit+Number15TakeProfit+Number16TakeProfit+
                                Number17TakeProfit+Number18TakeProfit+Number19TakeProfit+Number20TakeProfit)
                                                                    / 
                                (Number1OrderLots+Number2OrderLots+Number3OrderLots+Number4OrderLots+
                                Number5OrderLots+Number6OrderLots+Number7OrderLots+Number8OrderLots+
                                Number9OrderLots+Number10OrderLots+Number11OrderLots+Number12OrderLots+
                                Number13OrderLots+Number14OrderLots+Number15OrderLots+Number16OrderLots+
                                Number17OrderLots+Number18OrderLots+Number19OrderLots+Number20OrderLots);
  }
 }
 if(LotsManagement == false){
  NowOrderTakeProfit = OrderTakeProfit();
 }
 for(int i = 0; i < OrdersTotal(); i++){
  if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) == false) break;
//      if(OrderMagicNumber() != MAGIC || OrderSymbol() != Symbol()) continue;
  if(TimeHour(TimeCurrent())==OrderModifyTime && TimeMinute(TimeCurrent())==0 && TimeSeconds(TimeCurrent())==0){
   if(OrderTakeProfit() != 0){
    OrderModify(OrderTicket(),OrderOpenPrice(),0,NormalizeDouble(NowOrderTakeProfit,Digits)-Swap1dayPoint*Point,0,White);
   }
  }
 }
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

JK_Carry_Trade_EA | CM(0) | 2008/01/21(月) 20:02
コメントの投稿
題名
名前
メールアドレス
URL
コメント
PASS
SECRET管理者にだけ表示を許可する


上記広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書くことで広告を消せます。