time exceed

 

hello ,, i have a little problem in this function , when the time aarived as i mentionned it does not open any position ,, what should i add or change ?

Ps; when i make the variable StrToTime it make ''possible of loss of data due to type conversion

and the second one it shows any problemm but when i test it it don't give any open position at that time


 
use datetime, not double, for time1
 
neil324:
use datetime, not double, for time1
same thing ,, 0 error or warning but in the test nothing for any open trade at that time
 
Then, TimeGMT or TimeCurrent does not equal time1
 
neil324:
Then, TimeGMT or TimeCurrent does not equal time1
I tried in both cases and nothing new
 
TimeGMT & TimeCurrent are the current server time, in your code you are trying to compare them with a historical time, it will never match
 
neil324:
TimeGMT & TimeCurrent are the current server time, in your code you are trying to compare them with a historical time, it will never match
So how do i write : when a specific time come .. it open a trade?! 
 
rezk allah said fellah:
So how do i write : when a specific time come .. it open a trade?! 

https://www.mql5.com/en/forum/293560


go here

Finding bar by time
Finding bar by time
  • 2018.12.04
  • www.mql5.com
Hi How would you find a bar by a certain time for today Found this in the documentation, datetime date1 = D'2016.09...
 
rezk allah said fellah:

hello ,, i have a little problem in this function , when the time aarived as i mentionned it does not open any position ,, what should i add or change ?

Ps; when i make the variable StrToTime it make ''possible of loss of data due to type conversion

and the second one it shows any problemm but when i test it it don't give any open position at that time


   Do it this way.

datetime time1= D'2018.05.23 05:05:00';

 Keep in mind that your code only runs when a tick comes in.. if a tick does not come in during that second it will not trigger a trade.. when the tick finally comes in it will be past the right time.. you may want to say.

if(TimeCurrent()>=time1)//then make sure it can only enter once. with some other code.

Pip Pip.. Jimdandy

 
James Hodges:

   Do it this way.

 Keep in mind that your code only runs when a tick comes in.. if a tick does not come in during that second it will not trigger a trade.. when the tick finally comes in it will be past the right time.. you may want to say.

Pip Pip.. Jimdandy

it worked ,, thank you very mush sir i owe you