datetime Ten_Min_before_End_Of_Bar = Time[0] + ((Period() * 60) - (10 * 60));
deetrader999:
I want to close trades at the close of the bar -10 minutes before.
I want to close trades at the close of the bar -10 minutes before.
datetime barStart = Time[0], nextBar = barStart + Period() * 60, closeTime = nextBar - 10 * 60; if (TimeCurrent() >= closeTime) CloseAllOrders();
WHRoeder:
Thank-You both for your reply. That's an awesome answer. But there must have been something wrong with my computer about the two datetime hour codes. They both print out the current time of trade or question. And Hour() does work. All this today I find out. But your answer is very nice and quick. Thank-You very much. Deetrader999

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I wrote a program before using hours() & minutes() to find session times.It worked correctly. Now I've a aproblem using th same, and documentation sems to say that it is the time my ea ha been runing. And hours(timecurrent()) & minutes is the one to use. In my program I want to close trades at the close of the bar -10 minutes before. It always closes on the 4 hour interval. No matter which code I use. Im using 4 hour charts. Any help you can give me would be greatly appreciated. Thank-You.