|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I’m trying to get my expert to sleep after a loss trade,
For some reason it doesn't work. I’ve already checked that the proper order was selected. The script looks like this: int i=HistoryTotal(); OrderSelect(i,SELECT_BY_TICKET); if(OrderProfit()<0) { Sleep(900000); } If any one has experience with this function and has an idea what the problem is I’d appreciate your kind help! |
|
|||
|
Sleep doesn't seem to work
Hi
I am also having problems with sleep (lol). I find it doesn't work - definetly not when using stratergy tester to test an ea, so I set a variable to the time I want my expert to sleep and then check that variable Code:
if (CurTime()< time1)
{
return(0);
}
else
{
Sell1();
Print("SELL order opened : ",OrderOpenPrice());
time1 = CurTime()+2*60*Period();
}
|
|
|||
|
working
Found that you can't initilize time in the init() section
So go like this Code:
static double time1=0;
...
void init()
{
return(0)
}
int start()
{
if (CurTime()<= time1)
{
//Print(" Cur: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS)," time1: ",TimeToStr(time1,TIME_DATE|TIME_SECONDS));
return(0);
}
SellOrdOpen();
time1 = CurTime()+360;
}
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sleep function in EA between orders | icek | Metatrader 4 | 2 | 06-11-2007 04:10 PM |
| Programming question - sleep after a loss trade. | aleksd | Expert Advisors - Metatrader 4 | 12 | 08-12-2006 03:42 AM |
| function request | Alex.Piech.FinGeR | Metatrader 4 | 10 | 01-06-2006 06:08 PM |