molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Fri May 10, 2024 9:11 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 13 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Problem with Time() Functions
PostPosted: Wed May 30, 2012 5:41 pm 
Offline

Joined: Wed Mar 14, 2012 12:31 am
Posts: 118
Apparently, whether I use the MQL blocks, or the Molanis Time icons to control the opening and closing of positions, I still get the exact same outcome as follows:

- The initial trade (after clicking the Tester Start button) does open.
- The trade does not close on Monday - through Thursday at 23:59.
- No new trade is ever opened at the start of the next session at 00:00.
- The first trade remains open through all subsequent sessions.


Here's the primary structure:
Image

Here are the details of each setting:

- First Time icon controlling the Opening of positions:
Image

- Second Time icon controlling the Closing of positions for Mon - Thurs:
Image

- Third Time icon controlling the Closing of positions for Fri:
Image


I believe that I did what you told me to do. What am I dong wrong?

Thanks.
cfx


Top
 Profile  
 
 Post subject: Re: Problem with Time() Functions
PostPosted: Fri Jun 01, 2012 8:32 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
The way you use a time filter in your expert advisors is to add a time icon that connects from START to AND thus the logic in the same "branch (connected by the same AND)" will work only under the time filter defined in the time icon.

Quote:
For Open the position Monday through Friday, between 00:00 through 00:05.
Assuming you don't use a TA for an extra logic, in this case you don't need an AND. Just the time icon connected to the buy icon. Set all days to YES. Set hours start to 0, minute start to 0, hours end to 0 and minutes end to 5. You need to trade every tick. If you do not get a tick between 0 and 5 min it won't trade. That's the way mt4 works, you need a tick to run the ea.

Quote:
For Close the position on Friday, at 21:57.
You cannot close at a specific time, you can close if time > 21:57 Again, mt4 needs a tick to run the ea, if you get a tick at 21:57:01 it will close it right away, but if you don't get any tick until 21:58, the ea will close the position at 21:58 and not 21:57. Again this is the way metatrader works. You need info (ticks) from the server to trade. Late at night when volatility is low you may get ticks every 50 segs. At noon you get ticks every couple of seconds so time filters work better at trading times.
To close, just set Friday to YES, start at 21 57, end at 23 59 so you will have plenty of time to close the position


Top
 Profile  
 
 Post subject: Re: Problem with Time() Functions
PostPosted: Tue Jun 05, 2012 10:23 am 
Offline

Joined: Wed Mar 14, 2012 12:31 am
Posts: 118
Now, that was a very detailed explanation and exactly what I was looking for.

So, I was not too far off. I just needed to get the Start Time (Hours and Minutes) and the End Time (Hours and Minutes) of each Time icon, to make some sense.

Thank you very much, that helped out a great deal!

Regards,
cfx


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009