//-------------------------------------------------------------------6while(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 buyif(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 sellif(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 changedif(Lots < 0) // If lots are set
Lts=Lots; // Work with themelse
Lts=MathFloor(Free*Prots/One_Lot/Step)*Step; // For openingif(Lts > Min_Lot) Lts=Min_Lot; // Not less than minimalif(Lts*One_Lot > Free) // Lot larger than free margin
{
Alert("Not enough money for", Lts," lots");
return; // Exit start
}
//-------------------------------------------------------------------8while(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 openedAlert("Attempt to open Buy. Waiting for response..");
Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,3,SL,TP,NULL,0,0,Green); // Opening buyif(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 openedAlert("Attempt to open Sell. Waiting for response..");
Ticket=OrderSend(Symb,OP_SELL,Lts,Bid,3,SL,TP,NULL,0,0,Red); // Opening sellif(Ticket < 0) // Success
{
Alert("Opened order Sell ",Ticket);
return; // Exit start
}
return; // Exit start
}
break; // Exit while
}
//-------------------------------------------------------------------9return; // Exit start
}
//+------------------------------------------------------------------+
hi all,
this EA is working now?
I'm using this one on ichimoku
someone know it?