How to Sleep this ???

I'll recommend you add a time_stamp
static datetime time_stamp; if(time_current > time_stamp) ordersend()... datetime last_losing_order_function(datetime time_stamp) { if(loop_history and last_order=loss) time_stamp=(time_current+(60_seconds * 60_minutes * 12_hour)); return(time_stamp); }
Hi ubzen,
Sorry, but I don´t get where should I place it.
May you place it for me on this code? Please.
Best regards
// This is my code
double j; // Total of closed orders
for(j=0; j<OrdersHistoryTotal(); j++)
{
OrderSelect(j,SELECT_BY_POS,MODE_HISTORY);
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==magico && OrderProfit() > 0 )
{
comenta=comentario1;
lote=lotes1;
}
if(OrderSymbol()==Symbol() && OrderMagicNumber()==magico && OrderProfit() < 0 )
{
if (OrderLots()==lotes1)
{
lote=lotes2;
comenta=comentario2;
}
if (OrderLots()==lotes2)
{
lote=lotes3;
comenta=comentario3;
}
if (OrderLots()==lotes3)
{
lote=lotes4;
comenta=comentario4;
}
if (OrderLots()==lotes4)
{
lote=lotes5;
comenta=comentario5;
}
if (OrderLots()==lotes5)
{
lote=lotes6;
comenta=comentario6;
}
if (OrderLots()==lotes6)
{
lote=lotes1;
comenta=comentario1;
}
} // end of losts IF
} // end of ORDERSELECT
} // end of FOR
//-+-+-+-++-++-+-+-++-+-+--+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+++-+-+-+-++--+
// OPENING POSITIONS
if (AB>0.0 && BB>0.0 && MA0>0.0 && aTo0>aBo1 && sar<Close[0] && abertas!=1 && Close[0]>m1 && Close[0]>m5)
{
OrderSend(Symbol(),OP_BUY, lote, Ask, 3, Ask-sl*Point, Ask+tp*Point, comenta, magico, 0, White);
}
if (AB<0.0 && BB<0.0 && MA0<0.0 && aTo0<aBo1 && sar>Close[0] && abertas!=1 && Close[0]<m1 && Close[0]<m5)
{
OrderSend(Symbol(),OP_SELL, lote, Bid, 3, Bid+sl*Point, Bid-tp*Point, comenta, magico, 0, White);
}
Hi,
Here is my cycle to check the last closed order, to decide how many lots the next order will open.
It works fine, but I would like to introduce some break time, e.g. 12h or 24h, if the last order were a loser one.
I just can´t figure out how can I do that.
I already tryed in so many ways, but being a novice means this. :)
Any suggestions? Thanks.
Regards
double j; // Total of closed orders
for(j=0; j<OrdersHistoryTotal(); j++)
{
OrderSelect(j,SELECT_BY_POS,MODE_HISTORY);
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==magico && OrderProfit() > 0 )
{
comenta=comentario1;
lote=lotes1;
}
if(OrderSymbol()==Symbol() && OrderMagicNumber()==magico && OrderProfit() < 0 )
{
if (OrderLots()==lotes1)
{
lote=lotes2;
comenta=comentario2;
}
if (OrderLots()==lotes2)
{
lote=lotes3;
comenta=comentario3;
}
if (OrderLots()==lotes3)
{
lote=lotes4;
comenta=comentario4;
}
if (OrderLots()==lotes4)
{
lote=lotes5;
comenta=comentario5;
}
if (OrderLots()==lotes5)
{
lote=lotes6;
comenta=comentario6;
}
if (OrderLots()==lotes6)
{
lote=lotes1;
comenta=comentario1;
}
} // end of losts IF
} // end of ORDERSELECT
} // end of FOR