Time Shift...

 

Need answer. I want to delay next expert advisor decision for (n) minutes or exacty to the time of chosen period (M1, M5, M15 etc...), so i need some function inside expert advisor first to check wich period user is using and then sleep for this time, and put this code somewhere in start() function...


Thanks in advanced...

 
urosv wrote >>

Need answer. I want to delay next expert advisor decision for (n) minutes or exacty to the time of chosen period (M1, M5, M15 etc...), so i need some function inside expert advisor first to check wich period user is using and then sleep for this time, and put this code somewhere in start() function...

Thanks in advanced...

Period() or Bars should help you i guess :-)

if (startbar> Bars)
  {
   Comment("Wait for starting ...");
   return(0);
   } 

if (OpenOrder or else) startbar=Bars+1;
 
EADeveloper:

Period() or Bars should help you i guess :-)

Hi...

Thanks for your replay...

Can i put "int start()" in if or is there another approach to disable the start() if condition is not right ?

{
 initialising the start() 
}
 
urosv wrote >>

Hi...

Thanks for your replay...

Can i put "int start()" in if or is there another approach to disable the start() if condition is not right ?

i do like this ...

on the top, where you have all your extern ... i put int startbar=0;

in the code inside of start() after handling open postions and before i look for new signals to open an order i put

if (startbar> Bars)
{
Comment("Wait for starting ...");
return(0);
}

and only when i reach some condition like opening an order or loosing an order :-) i put the startbar=Bars+1;

 
EADeveloper:

i do like this ...

on the top, where you have all your extern ... i put int startbar=0;

in the code inside of start() after handling open postions and before i look for new signals to open an order i put

if (startbar> Bars)
{
Comment("Wait for starting ...");
return(0);
}

and only when i reach some condition like opening an order or loosing an order :-) i put the startbar=Bars+1;

The condition in my case is NEW candle and not tick if this is even possible or time in period of n minutes for exaple if user is using M15 then wait 15 minutes ?

Thanks for your help...Function Bar is right answer sorry i have looked at sources and see that time is not hh:mm:ss but only hh:mm on jurnal so there is realy an event that can be triggered

Reason: