IchiMaWa





#property copyright "Wall-khi"
extern double Lots=1;
//---- input parameters
int init()
 {
 return(0);
 }
int deinit()
 {
 return(0);
 }

int start()
 {
 int ticket;
 double noopen;
 double CloseBuyStrong, CloseSellStrong, BuyCancel, SellCancel;
 double CloseBuyMedium, CloseSellMedium;
 double CloseBuyWeak, CloseSellWeak;
 
 double stop=1000; //no definite stop yet
 double profit=1000; //no definite limit either
 
 datetime t; 

//Various Ichimokus
 double a=9;
 double b=26;
 double c=52;
 double dp=13;
 double KumoHigh,KumoLow;
 double StrongBuyCross1, StrongBuyPrice1, StrongBuySwap1, StrongSellCross1, StrongSellPrice1, StrongSellSwap1;
 double MediumBuyCross1, MediumBuyPrice1, MediumBuySwap1, MediumSellCross1, MediumSellPrice1, MediumSellSwap1;
 double WeakBuyCross1, WeakBuyPrice1, WeakBuySwap1, WeakSellCross1, WeakSellPrice1, WeakSellSwap1;
 double StrongBuyCross2, StrongBuyPrice2, StrongBuySwap2, StrongSellCross2, StrongSellPrice2, StrongSellSwap2;
 double MediumBuyCross2, MediumBuyPrice2, MediumBuySwap2, MediumSellCross2, MediumSellPrice2, MediumSellSwap2;
 double WeakBuyCross2, WeakBuyPrice2, WeakBuySwap2, WeakSellCross2, WeakSellPrice2, WeakSellSwap2;
 double tenkan = iIchimoku(NULL, 0, a, b, c, MODE_TENKANSEN, 1);
 double pretenkan = iIchimoku(NULL, 0, a, b, c, MODE_TENKANSEN, 2);
 double expretenkan = iIchimoku(NULL, 0, a, b, c, MODE_TENKANSEN,3);
 double kijun = iIchimoku(NULL, 0, a, b, c, MODE_KIJUNSEN, 1);
 double prekijun = iIchimoku(NULL, 0, a, b, c, MODE_KIJUNSEN, 2);
 double exprekijun = iIchimoku(NULL, 0, a, b, c, MODE_KIJUNSEN, 3);
 double senkouA = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANA, 1);
 double senkouB = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANB, 1);
 double presenkouA = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANA, 2);
 double presenkouB = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANB, 2);
 double expresenkouA = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANA, 3);
 double expresenkouB = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANB, 3);
 double chinkou = iIchimoku(NULL, 0, a, b, c, MODE_CHINKOUSPAN, 27);
 double senkouA26 = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANA, -25);
 double senkouB26 = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANB, -25);
 double senkouA25 = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANA, -24);
 double senkouB25 = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANB, -24);
 double senkouA24 = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANA, -20);
 double senkouB24 = iIchimoku(NULL, 0, a, b, c, MODE_SENKOUSPANB, -20);


  //KUMO
 if (senkouA>senkouB) KumoHigh=senkouA;
 if (senkouA<=senkouB) KumoHigh=senkouB;
 if (senkouA>senkouB) KumoLow=senkouB;
 if (senkouA<=senkouB) KumoLow=senkouA;


 //STRONG LONG SIGNALS
 if (expretenkan<=exprekijun && pretenkan>prekijun && iLow(NULL,0,1)>KumoHigh && tenkan>kijun) 
  {StrongBuyCross1=1;
   StrongBuyCross2=1;
  }
 if (iLow(NULL,0,2)<=exprekijun && iLow(NULL,0,1)>prekijun && prekijun>KumoHigh &&  tenkan>kijun && iClose(NULL,0,1)>KumoHigh) 
  {StrongBuyPrice1=1;
   StrongBuyPrice2=1;
  }
 if (senkouA24<senkouB24 && senkouA26>senkouB26 && senkouA25<senkouA26 && senkouA26>senkouB26 && senkouA26+10*Point>=senkouA24 && tenkan>kijun)
  {StrongBuySwap1=1;
   StrongBuySwap2=1;
  }

 //STRONG SHORT SIGNALS
 if (expretenkan>=exprekijun && pretenkan<prekijun && iHigh(NULL,0,1)<KumoLow && tenkan<kijun) 
  {StrongSellCross1=1;
   StrongSellCross2=1;
  }
 if (iHigh(NULL,0,2)>=prekijun && iHigh(NULL,0,1)<prekijun && prekijun<KumoLow &&  tenkan<kijun && iClose(NULL,0,1)<KumoLow) 
  {StrongSellPrice1=1;
   StrongSellPrice2=1;
  }
 if (senkouA24>senkouB24 && senkouA26<senkouB26 && senkouA25>senkouA26 && senkouA26<senkouB26 && senkouA26+10*Point<=senkouA24 && tenkan<kijun) 
  {StrongSellSwap1=1;
   StrongSellSwap2=1;
  }

//MODERATE LONG SIGNALS
 if (expretenkan<=exprekijun && pretenkan>prekijun && iClose(NULL,0,1)>KumoLow && iClose(NULL,0,1)<KumoHigh) 
  {MediumBuyCross1=1;
   MediumBuyCross2=1;
  }
 if (iLow(NULL,0,2)<=exprekijun && iLow(NULL,0,1)>prekijun && iClose(NULL,0,1)>KumoLow && iClose(NULL,0,1)<KumoHigh) 
  {MediumBuyPrice1=1;
   MediumBuyPrice2=1;
  }

 //MODERATE SHORT SIGNALS
 if (expretenkan>=exprekijun && pretenkan<prekijun && iClose(NULL,0,1)>KumoLow && iClose(NULL,0,1)<KumoHigh) 
  {MediumSellCross1=1;
   MediumSellCross2=1;
  }
 if (iHigh(NULL,0,2)>=exprekijun && iHigh(NULL,0,1)<prekijun && iClose(NULL,0,1)>KumoLow && iClose(NULL,0,1)<KumoHigh) 
  {MediumSellPrice1=1;
   MediumSellPrice2=1;
  }
 
 //WEAK LONG SIGNALS
 if (expretenkan<=exprekijun && pretenkan>prekijun && iHigh(NULL,0,1)<KumoLow) 
  {WeakBuyCross1=1;
   WeakBuyCross2=1;
  }
 if (iLow(NULL,0,2)<=exprekijun && iLow(NULL,0,1)>prekijun && iHigh(NULL,0,1)<KumoLow) 
  {WeakBuyPrice1=1;
   WeakBuyPrice2=1;
  }

 //WEAK SHORT SIGNALS
 if (expretenkan>=exprekijun && pretenkan<prekijun && iLow(NULL,0,1)>KumoHigh) 
  {WeakSellCross1=1;
   WeakSellCross2=1;
  }
 if (iHigh(NULL,0,2)>=exprekijun && iHigh(NULL,0,1)<prekijun && iLow(NULL,0,1)>KumoHigh) 
  {WeakSellPrice1=1;
   WeakSellPrice2=1;
  }
 
 //CHINKOU CONFIRMATION
if (chinkou<=iHigh(NULL,0,b)) BuyCancel=1;
if (chinkou>=iLow(NULL,0,b)) SellCancel=1;
 
 //DeMARKER CONFIRMATION
if (iDeMarker(NULL,0,dp,1) <0.5) BuyCancel=1;
if (iDeMarker(NULL,0,dp,1) >0.5) SellCancel=1;

 //DIFFERENCE CONFIRMATION
if (iLow(NULL,0,1)-KumoHigh>100*Point) BuyCancel=1;
if (KumoLow-iHigh(NULL,0,1)>100*Point) SellCancel=1;
    
  //CLOSING Conditions
 if (tenkan<kijun || iClose(NULL,0,1)<KumoHigh) CloseBuyStrong=1;
 if (tenkan>kijun || iClose(NULL,0,1)>KumoLow) CloseSellStrong=1;
 
 if (tenkan<kijun) CloseBuyMedium=1;
 if (tenkan>kijun) CloseSellMedium=1;

 if (tenkan<kijun) CloseBuyWeak=1;
 if (tenkan>kijun) CloseSellWeak=1; 

 //No repeat order in the same bar
      OrderSelect(OrdersHistoryTotal(),SELECT_BY_TICKET,MODE_HISTORY);
      t=OrderOpenTime();
      if (t>=Time[0]) noopen=1;
      //if (noopen==1) return(0);

  //If the order is alive, don't execute a new one with the same kind.
  int ot = OrdersTotal();
  for(int say=ot-1;say>=0;say--)
   {
    OrderSelect(say, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==1) StrongBuyCross1=0;
    if (OrderMagicNumber()==2) StrongBuyCross2=0;
    if (OrderMagicNumber()==3) StrongBuyPrice1=0;
    if (OrderMagicNumber()==4) StrongBuyPrice2=0;
    if (OrderMagicNumber()==5) StrongBuySwap1=0;
    if (OrderMagicNumber()==6) StrongBuySwap2=0;
    if (OrderMagicNumber()==7) StrongSellCross1=0;
    if (OrderMagicNumber()==8) StrongSellCross2=0;
    if (OrderMagicNumber()==9) StrongSellPrice1=0;
    if (OrderMagicNumber()==10) StrongSellPrice2=0;
    if (OrderMagicNumber()==11) StrongSellSwap1=0;
    if (OrderMagicNumber()==12) StrongSellSwap2=0;
    if (OrderMagicNumber()==13) MediumBuyCross1=0;
    if (OrderMagicNumber()==14) MediumBuyCross2=0;
    if (OrderMagicNumber()==15) MediumBuyPrice1=0;
    if (OrderMagicNumber()==16) MediumBuyPrice2=0;
    if (OrderMagicNumber()==17) MediumBuySwap1=0;
    if (OrderMagicNumber()==18) MediumBuySwap2=0;
    if (OrderMagicNumber()==19) MediumSellCross1=0;
    if (OrderMagicNumber()==20) MediumSellCross2=0;
    if (OrderMagicNumber()==21) MediumSellPrice1=0;
    if (OrderMagicNumber()==22) MediumSellPrice2=0;
    if (OrderMagicNumber()==23) MediumSellSwap1=0;
    if (OrderMagicNumber()==24) MediumSellSwap2=0;
    if (OrderMagicNumber()==25) WeakBuyCross1=0;
    if (OrderMagicNumber()==26) WeakBuyCross1=0;
    if (OrderMagicNumber()==27) WeakBuyPrice1=0;
    if (OrderMagicNumber()==28) WeakBuyPrice2=0;
    if (OrderMagicNumber()==29) WeakBuySwap1=0;
    if (OrderMagicNumber()==30) WeakBuySwap2=0;
    if (OrderMagicNumber()==31) WeakSellCross1=0;
    if (OrderMagicNumber()==32) WeakSellCross1=0;
    if (OrderMagicNumber()==33) WeakSellPrice1=0;
    if (OrderMagicNumber()==34) WeakSellPrice2=0;
    if (OrderMagicNumber()==35) WeakSellSwap1=0;
    if (OrderMagicNumber()==36) WeakSellSwap2=0;
   }
    
//  LONG ORDERS
//  if (noopen==0 && StrongBuyCross1 == 1 && KumoHigh-KumoLow>5*Point && iLow(NULL,0,1)>KumoHigh && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"SBC1",1,0,DarkGreen);
  if (noopen==0 && StrongBuyCross2 == 1 && KumoHigh-KumoLow>5*Point && iLow(NULL,0,1)>KumoHigh && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"SBC2",2,0,DarkGreen);
  if (noopen==0 && StrongBuyPrice1 == 1 && iLow(NULL,0,1)>KumoHigh && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"SBP1",3,0,ForestGreen);
//  if (noopen==0 && StrongBuyPrice2 == 1 && iLow(NULL,0,1)>KumoHigh && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"SBP2",4,0,ForestGreen);
  if (noopen==0 && StrongBuySwap1 == 1 && iLow(NULL,0,1)>KumoHigh) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"SBS1",5,0,Lime);
//  if (noopen==0 && StrongBuySwap2 == 1 && iLow(NULL,0,1)>KumoHigh && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"SBS2",6,0,Lime);

//  if (noopen==0 && MediumBuyCross1 == 1 && KumoHigh-KumoLow>5*Point && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"MBC1",13,0,DarkGreen);
//  if (noopen==0 && MediumBuyCross2 == 1 && KumoHigh-KumoLow>5*Point && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"MBC2",14,0,DarkGreen);
//  if (noopen==0 && MediumBuyPrice1 == 1 && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"MBP1",15,0,ForestGreen);
//  if (noopen==0 && MediumBuyPrice2 == 1 && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"MBP2",16,0,ForestGreen);

  if (noopen==0 && WeakBuyCross1 == 1 && KumoHigh-KumoLow>5*Point && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"WBC1",25,0,DarkGreen);
//  if (noopen==0 && WeakBuyCross2 == 1 && KumoHigh-KumoLow>5*Point && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"WBC2",26,0,DarkGreen);
  if (noopen==0 && WeakBuyPrice1 == 1 && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"WBP1",27,0,ForestGreen);
//  if (noopen==0 && WeakBuyPrice2 == 1 && BuyCancel==0) ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Lots,Ask-stop*Point,Ask+profit*Point,"WBP2",28,0,ForestGreen);

//  SHORT ORDERS
// if (noopen==0 && StrongSellCross1 == 1 && KumoHigh-KumoLow>5*Point && iHigh(NULL,0,1)<KumoLow && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"SSC1",7,0,Purple);
 if (noopen==0 && StrongSellCross2 == 1 && KumoHigh-KumoLow>5*Point && iHigh(NULL,0,1)<KumoLow && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"SSC2",8,0,Purple);
 if (noopen==0 && StrongSellPrice1 == 1 && iHigh(NULL,0,1)<KumoLow && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"SSP1",9,0,DarkViolet);
// if (noopen==0 && StrongSellPrice2 == 1 && iHigh(NULL,0,1)<KumoLow && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"SSP2",10,0,DarkViolet);
 if (noopen==0 && StrongSellSwap1 == 1 && iHigh(NULL,0,1)<KumoLow) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"SSS1",11,0,MediumVioletRed);
// if (noopen==0 && StrongSellSwap2 == 1 && iHigh(NULL,0,1)<KumoLow && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"SSS2",12,0,MediumVioletRed);   
   
//    if (noopen==0 && MediumSellCross1 == 1 && KumoHigh-KumoLow>5*Point && iHigh(NULL,0,1)<KumoLow && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"MSC1",19,0,Purple);
//    if (noopen==0 && MediumSellCross2 == 1 && KumoHigh-KumoLow>5*Point && iHigh(NULL,0,1)<KumoLow && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"MSC2",20,0,Purple);
//    if (noopen==0 && MediumSellPrice1 == 1 && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"MSP1",21,0,DarkViolet);
//    if (noopen==0 && MediumSellPrice2 == 1 && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"MSP2",22,0,DarkViolet);
 
    if (noopen==0 && WeakSellCross1 == 1 && KumoHigh-KumoLow>5*Point && iHigh(NULL,0,1)<KumoLow && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"WSC1",31,0,Purple);
//    if (noopen==0 && WeakSellCross2 == 1 && KumoHigh-KumoLow>3*Point && iHigh(NULL,0,1)<KumoLow && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"WSC2",32,0,Purple);
    if (noopen==0 && WeakSellPrice1 == 1 && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"WSP1",33,0,DarkViolet);
//    if (noopen==0 && WeakSellPrice2 == 1 && SellCancel==0) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Lots,Bid+stop*Point,Bid-profit*Point,"WSP2",34,0,DarkViolet);
   
    StrongBuyCross1=0;
    StrongBuyPrice1=0;
    StrongBuySwap1=0;
    StrongBuyCross2=0;
    StrongBuyPrice2=0;
    StrongBuySwap2=0;
    MediumBuyCross1=0;
    MediumBuyPrice1=0;
    MediumBuySwap1=0;
    MediumBuyCross2=0;
    MediumBuyPrice2=0;
    MediumBuySwap2=0;
    WeakBuyCross1=0;
    WeakBuyPrice1=0;
    WeakBuySwap1=0;
    WeakBuyCross2=0;
    WeakBuyPrice2=0;
    WeakBuySwap2=0;    
    BuyCancel=0;
    
    StrongSellCross1=0;
    StrongSellPrice1=0;
    StrongSellSwap1=0;
    StrongSellCross2=0;
    StrongSellPrice2=0;
    StrongSellSwap2=0;
    MediumSellCross1=0;
    MediumSellPrice1=0;
    MediumSellSwap1=0;
    MediumSellCross2=0;
    MediumSellPrice2=0;
    MediumSellSwap2=0;
    WeakSellCross1=0;
    WeakSellPrice1=0;
    WeakSellSwap1=0;
    WeakSellCross2=0;
    WeakSellPrice2=0;
    WeakSellSwap2=0;
    SellCancel=0;

// CLOSINGS THE POSITIONS
// SBC: Strong Buy Cross, SBP: Strong Buy Price, SBS: Strong Buy Swap the Cloud 
// SSC: Strong Sell Cross, SSP: Strong Sell Price, SSS: Strong Sell Swap the Cloud
// M**: Midium * *
// W**: Weak * *

// SBC1 Close
if (CloseBuyStrong==1)
 {int otb1 = OrdersTotal();
  for(int sayb1=otb1-1;sayb1>=0;sayb1--)
   {OrderSelect(sayb1, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==1) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }
// SBC2 Close
 if (iLow(NULL,0,0)<KumoHigh)
 {int otb2 = OrdersTotal();
  for(int sayb2=otb2-1;sayb2>=0;sayb2--)
   {OrderSelect(sayb2, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==2) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }
 
 //SSC1 Close
 if (CloseSellStrong==1)
 {int ots1 = OrdersTotal();
  for(int says1=ots1-1;says1>=0;says1--)
   {OrderSelect(says1, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==7) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }
 // SSC2 Close
 if (iHigh(NULL,0,0)>KumoLow)
 {int ots2 = OrdersTotal();
  for(int says2=ots2-1;says2>=0;says2--)
   {OrderSelect(says2, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==8) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } } 

// SBP1 Close
//if (CloseBuyStrong==1 && iClose(NULL,0,1)<tenkan )
if (CloseBuyStrong==1)
 {int otb3 = OrdersTotal();
  for(int sayb3=otb3-1;sayb3>=0;sayb3--)
   {OrderSelect(sayb3, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==3) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }
// SBP2 Close
//if (iLow(NULL,0,0)<KumoHigh)
if (exprekijun>prekijun)
 {int otb4 = OrdersTotal();
  for(int sayb4=otb4-1;sayb4>=0;sayb4--)
   {OrderSelect(sayb4, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==4) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }

// SSP1 Close
if (CloseSellStrong==1)
 {int ots3 = OrdersTotal();
  for(int says3=ots3-1;says3>=0;says3--)
   {OrderSelect(says3, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==9) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }
// SSP2 Close
if (exprekijun<prekijun)
 {int ots4 = OrdersTotal();
  for(int says4=ots4-1;says4>=0;says4--)
   {OrderSelect(says4, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==10) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }

// SBS1 Close
if (iLow(NULL,0,1)<kijun)
 {int otb5 = OrdersTotal();
  for(int sayb5=otb5-1;sayb5>=0;sayb5--)
   {OrderSelect(sayb5, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==5) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }
// SBS2 Close
if (senkouA26+10*Point<senkouA24)
 {int otb6 = OrdersTotal();
  for(int sayb6=otb6-1;sayb6>=0;sayb6--)
   {OrderSelect(sayb6, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==6) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }

// SSS1 Close
//if (tenkan>kijun )
if (iHigh(NULL,0,1)>kijun)
 {int ots5 = OrdersTotal();
  for(int says5=ots5-1;says5>=0;says5--)
   {OrderSelect(says5, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==11) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }
// SSS2 Close
//if (iHigh(NULL,0,0)>KumoLow)
if (senkouA26+10*Point>senkouA24)
 {int ots6 = OrdersTotal();
  for(int says6=ots6-1;says6>=0;says6--)
   {OrderSelect(says6, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==12) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }


// MBC1 Close
if (CloseBuyMedium==1 && iClose(NULL,0,1)<KumoLow)
 {otb1 = OrdersTotal();
  for(sayb1=otb1-1;sayb1>=0;sayb1--)
   {OrderSelect(sayb1, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==13) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }
// MBC2 Close
 if (CloseBuyMedium==1)
 {otb2 = OrdersTotal();
  for(sayb2=otb2-1;sayb2>=0;sayb2--)
   {OrderSelect(sayb2, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==14) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }
 
//MSC1 Close
 if (CloseSellMedium==1 && iClose(NULL,0,1)>KumoHigh)
 {ots1 = OrdersTotal();
  for(says1=ots1-1;says1>=0;says1--)
   {OrderSelect(says1, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==19) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }
// MSC2 Close
 if (CloseSellMedium==1)
 {ots2 = OrdersTotal();
  for(says2=ots2-1;says2>=0;says2--)
   {OrderSelect(says2, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==20) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }

// MBP1 Close
if (CloseBuyMedium==1 && iClose(NULL,0,1)<KumoLow)
 {otb3 = OrdersTotal();
  for(sayb3=otb3-1;sayb3>=0;sayb3--)
   {OrderSelect(sayb3, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==15) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }
// MBP2 Close
if (CloseBuyMedium==1)
 {otb4 = OrdersTotal();
  for(sayb4=otb4-1;sayb4>=0;sayb4--)
   {OrderSelect(sayb4, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==16) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }

 // MSP1 Close
if (CloseSellMedium==1 && iClose(NULL,0,1)>KumoHigh)
 {ots3 = OrdersTotal();
  for(says3=ots3-1;says3>=0;says3--)
   {OrderSelect(says3, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==21) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }
// MSP2 Close
if (CloseSellMedium==1)
 {ots4 = OrdersTotal();
  for(says4=ots4-1;says4>=0;says4--)
   {OrderSelect(says4, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==22) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }


// WBC1 Close
if (CloseBuyWeak==1 && iClose(NULL,0,1)<KumoLow)
 {otb1 = OrdersTotal();
  for(sayb1=otb1-1;sayb1>=0;sayb1--)
   {OrderSelect(sayb1, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==25) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }
//// WBC2 Close
 if (CloseBuyWeak==1)
 {otb2 = OrdersTotal();
  for(sayb2=otb2-1;sayb2>=0;sayb2--)
   {OrderSelect(sayb2, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==26) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }

//WSC1 Close
 if (CloseSellWeak==1)
 {ots1 = OrdersTotal();
  for(says1=ots1-1;says1>=0;says1--)
   {OrderSelect(says1, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==31) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }
 // WSC2 Close
 if (CloseSellWeak==1)
 {ots2 = OrdersTotal();
  for(says2=ots2-1;says2>=0;says2--)
   {OrderSelect(says2, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==32) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }

// WBP1 Close
if (CloseBuyWeak==1)
 {otb3 = OrdersTotal();
  for(sayb3=otb3-1;sayb3>=0;sayb3--)
   {OrderSelect(sayb3, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==27) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }
// WBP2 Close
if (CloseBuyWeak==1)
 {otb4 = OrdersTotal();
  for(sayb4=otb4-1;sayb4>=0;sayb4--)
   {OrderSelect(sayb4, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==28) OrderClose( OrderTicket(), OrderLots(), Ask, 3, Red );
 } }

 // WSP1 Close
if (CloseSellWeak==1)
 {ots3 = OrdersTotal();
  for(says3=ots3-1;says3>=0;says3--)
   {OrderSelect(says3, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==33) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }
// WSP2 Close
if (CloseSellWeak==1)
 {ots4 = OrdersTotal();
  for(says4=ots4-1;says4>=0;says4--)
   {OrderSelect(says4, SELECT_BY_POS, MODE_TRADES);
    if (OrderMagicNumber()==34) OrderClose( OrderTicket(), OrderLots(), Bid, 3, Red );
 } }
 
CloseBuyStrong=0; 
CloseSellStrong=0;
CloseBuyMedium=0; 
CloseSellMedium=0;
return(0);
}



Sample





Analysis



Market Information Used:

Series array that contains the lowest prices of each bar
Series array that contains close prices for each bar
Series array that contains the highest prices of each bar
Series array that contains open time of each bar


Indicator Curves created:


Indicators Used:

Ichimoku Kinko Hyo
DeMarker indicator


Custom Indicators Used:

Order Management characteristics:

Checks for the total of closed orders
Checks for the total of open orders
It automatically opens orders when conditions are reached
It Closes Orders by itself

Other Features:

BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.82 Total Net Profit:-2276.40

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.09 Total Net Profit:-10451.10

BackTest : EURUSD on H1

From 2010-03-01 to 2010-03-27 Profit Factor:0.57 Total Net Profit:-3010.90

BackTest : EURUSD on H1

From 2010-04-01 to 2010-04-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-05-01 to 2010-05-31 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-06-01 to 2010-06-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-02-27 Profit Factor:0.70 Total Net Profit:-3044.10

BackTest : USDCAD on H1

From 2009-01-01 to 2010-01-01 Profit Factor:1.00 Total Net Profit:239.74

BackTest : USDCAD on H1

From 2009-12-01 to 2010-01-01 Profit Factor:1.83 Total Net Profit:2551.25

BackTest : USDCHF on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.47 Total Net Profit:-3292.49

BackTest : USDJPY on H1

From 2009-11-01 to 2009-11-30 Profit Factor:1.33 Total Net Profit:1120.79

Request Backtest for IchiMaWa


From : (yyyy/mm/dd) To: (yyyy/mm/dd)

Pair: Period: