Ichimoku Expert Advisor - page 2

 
//-------------------------------------------------------------------6
   while(true)                                  // Loop of closing orders 
     {
      if( Tip==0 && Cls_B==true)                // Order buy is opened and there is criterion to close 
        {
         Alert("Attempt to close Buy ",Ticket,". Waiting for response..");
         RefreshRates();                        // Refresh rates
         Ans=OrderClose(Ticket,Lot,Bid,3,Yellow);      // Closing buy
         if(Ans==true)                          // Close buy success
           {
            Alert("Closed order Buy ",Ticket);  // Alert closed order buy 
            break;                              // Exit closing loop
           }
         return;                                // Exit start
        }
      if( Tip==1 && Cls_S==true)                // Order sell is opened and there is criterion to close 
        {
         Alert("Attempt to close Sell ",Ticket,". Waiting for response..");
         RefreshRates();                        // Refresh rates
         Ans=OrderClose(Ticket,Lot,Ask,3,Yellow);      // Closing sell
         if(Ans==true)                          // Close sell success
           {
            Alert("Closed order Sell ",Ticket); // Alert closed order sell 
            break;                              // Exit closing loop
           }
         return;                                // Exit start
        }
      break;
     }
//-------------------------------------------------------------------7
   RefreshRates();                                 // Refresh Values
   Min_Lot=MarketInfo(Symb,MODE_MINLOT);           // Minimal number of lots
   Free=AccountMargin();                           // Free Margin
   One_Lot=MarketInfo(Symb,MODE_MARGINREQUIRED);   // Price of 1 lot
   Step=MarketInfo(Symb,MODE_LOTSTEP);             // Step is changed
   
   if(Lots < 0)                                    // If lots are set 
     Lts=Lots;                                     // Work with them
   else
     Lts=MathFloor(Free*Prots/One_Lot/Step)*Step;  // For opening
     
   if(Lts > Min_Lot) Lts=Min_Lot;                  // Not less than minimal
   if(Lts*One_Lot > Free)                          // Lot larger than free margin
     {
      Alert("Not enough money for", Lts," lots"); 
      return;                                      // Exit start
     }   
//-------------------------------------------------------------------8
   while(true)                                           // Orders closing loop
     {
      if(Total==0 && Opn_B==true)                        // No new orders and criterion for opening buy
        {
         RefreshRates();                                 // Refresh rates
         SL=Bid - (StopLoss)*Point;              // Calculating SL of opened
         TP=Bid + (TakeProfit)*Point;            // Calculating TP of opened
         Alert("Attempt to open Buy. Waiting for response..");
         Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,3,SL,TP,NULL,0,0,Green);  // Opening buy
         if(Ticket < 0)                                  // Success
           {
            Alert("Opened order Buy ",Ticket);
            return;                                      // Exit start
           }
         return;                                         // Exit start
        }
      if(Total==0 && Opn_S==true)                        // No new orders and criterion for opening sell
        {
         RefreshRates();                                 // Refresh rates
         SL=Ask + (StopLoss)*Point;              // Calculating SL of opened
         TP=Ask - (TakeProfit)*Point;            // Calculating TP of opened
         Alert("Attempt to open Sell. Waiting for response..");
         Ticket=OrderSend(Symb,OP_SELL,Lts,Bid,3,SL,TP,NULL,0,0,Red); // Opening sell
         if(Ticket < 0)                                  // Success
           {
            Alert("Opened order Sell ",Ticket);
            return;                                      // Exit start
           }
         return;                                         // Exit start
        } 
      break;                                             // Exit while 
     }
//-------------------------------------------------------------------9
   return;                                               // Exit start
  }
//+------------------------------------------------------------------+
 

hi all, 

this EA is working now?


I'm using this one on ichimoku 

someone know it?

Ichimoku Expert Advisor
Ichimoku Expert Advisor
  • 2013.09.06
  • www.mql5.com
Hi, I've been trying to create a simple expert advisor based on the Ichimoku Strategy. That is, when the TenkanSen is higher than KijunSen, buy...
Reason: