
Y no se si se puede o bien descompilar el EA y agregar ese "timer" (cosa q no tengo ni idea) o bien hay algun cacharrillo por ahi para tal fin...
Gracias a todos de antemano, viva el metatrader!
Código: Seleccionar todo
//+------------------------------------------------------------------+
//| Temp_Maliboo.mq4 |
//| Copyright © 2009, NsTrader |
//| [email protected] |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, NsTrader"
#property link "[email protected]"
extern int Hora = 3;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
int THora = TimeHour(TimeCurrent());
int TMin = TimeMinute(TimeCurrent());
Comment(THora,":",TMin);
if(Hora == THora)
{
OClose(false);//true cierra solo las que estén en beneficio / false cierra todas
}
//----
return(0);
}
//+------------------------------------------------------------------+
void OClose(bool profit)
{
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderSymbol() != Symbol()) continue;
if(OrderType() <= 1 && ((profit && OrderProfit() > 0) || !profit))
{
color c;
double closePrice;
int tradeDirection = 1 - 2 * ( OrderType() % 2 );
if( tradeDirection > 0)
{
c = Blue;
closePrice = MarketInfo(Symbol(),MODE_BID);
}
else
{
c = Violet;
closePrice = MarketInfo(Symbol(),MODE_ASK);
}
OrderClose(OrderTicket(), OrderLots(), closePrice, 3, c);
}
}
}