j ai trouvé ce script mais je voudrai qu il ne fonctionne qu avec le take profit.
Quelqu un pourrait il le modifier ?
Merci
Script :
//+------------------------------------------------------------------+
//| Close All 1_0.mq4 |
//| Copyright © 2007, Wolfe |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, Wolfe"
#property link ""
extern double Stop_Loss=-200; //If open order dollar amount is < Stop_Loss value Close All will be executrd
extern double Take_Profit=200;//If open order dollar amount is > Take_Profit value Close All will be executed
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
if ((AccountProfit() < Stop_Loss) || (AccountProfit() > Take_Profit))
{
while(OrdersTotal()>0)
{
OrderSelect(0,SELECT_BY_POS);
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),999,Purple);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),999,Purple);
if(OrderType()==OP_BUYLIMIT||OrderType()==OP_BUYSTOP||OrderType()==OP_SELLLIMIT||OrderType()==OP_SELLSTOP)
OrderDelete(OrderTicket());
}
}
//----
return(0);
}
//+------------------------------------------------------------------+