• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 1:30pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:30pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Mt4 Close Profit positions before Market closed on weekend? 1 reply

After Market Hours and determining weekend gaps 0 replies

[MT4] - Detect when price approaches arbitrary drawn objects 1 reply

best was to detect new bar 7 replies

How can I detect a specific TF to diff-TF change? Static doesn't work. 10 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: How to detect it's 2 hours before market close for the weekend ?
Cancel

How to detect it's 2 hours before market close for the weekend ?

  • Post #1
  • Quote
  • First Post: Apr 10, 2008 3:27pm Apr 10, 2008 3:27pm
  •  hongkonger
  • | Joined Dec 2007 | Status: i am a hongkonger working in london | 54 Posts
The Time[0] function does not let me to use a negative index to get the time for the next bar... My purpose of getting the time for next bar is to close my existing positions 2 hours before the weekend..

Also, I do not know whether the next trade day is holiday or not, for example, on thursday night, I should do the same for friday night in case friday is not a trading day.

Anybody can give me some hints? Thank you very much !!
  • Post #2
  • Quote
  • Apr 10, 2008 5:18pm Apr 10, 2008 5:18pm
  •  magnumfreak
  • Joined Nov 2007 | Status: Trying manual mode again | 2,210 Posts
You can use DayOfWeek to determine what day of the week it is. Use TimeHour(TimeCurrent()) to find out what the hour of the day is. Then just write your ea to close your positions when you are at a certain day of the week and certain time of the day.
 
 
  • Post #3
  • Quote
  • Apr 11, 2008 6:24am Apr 11, 2008 6:24am
  •  hongkonger
  • | Joined Dec 2007 | Status: i am a hongkonger working in london | 54 Posts
Quoting magnumfreak
Disliked
You can use DayOfWeek to determine what day of the week it is. Use TimeHour(TimeCurrent()) to find out what the hour of the day is. Then just write your ea to close your positions when you are at a certain day of the week and certain time of the day.
Ignored
I know but I do not know whether the next day is a trading day unless it is friday. If friday is a holiday, I cannot know. I am now typing my calendar data file and then import into the program by csv..
 
 
  • Post #4
  • Quote
  • Apr 11, 2008 9:23am Apr 11, 2008 9:23am
  •  magnumfreak
  • Joined Nov 2007 | Status: Trying manual mode again | 2,210 Posts
Another method would be to set up 5 bool variables and when one or more of them is set to true then the EA would know that day is a no trade day and close orders appropriately. Once a week you would go in and set whichever days to true that are holidays and when the next week rolls around set it to false.
 
 
  • Post #5
  • Quote
  • Apr 11, 2008 9:56am Apr 11, 2008 9:56am
  •  hongkonger
  • | Joined Dec 2007 | Status: i am a hongkonger working in london | 54 Posts
Quoting magnumfreak
Disliked
Another method would be to set up 5 bool variables and when one or more of them is set to true then the EA would know that day is a no trade day and close orders appropriately. Once a week you would go in and set whichever days to true that are holidays and when the next week rolls around set it to false.
Ignored
Hi magnumfreak thank you, I think I will do it once for a year..

Btw, do you know whether I can access the broker's annoucement by MQL4 commands? I noticed that sometimes the broker told me that they are closing in few hours, I cannot remeber whether they will only close in bank holidays or not..
 
 
  • Post #6
  • Quote
  • Apr 11, 2008 10:14am Apr 11, 2008 10:14am
  •  magnumfreak
  • Joined Nov 2007 | Status: Trying manual mode again | 2,210 Posts
unfortunately you can only sendmail not read it. One of the many limitations of mt4.
 
 
  • Post #7
  • Quote
  • Apr 11, 2008 10:20am Apr 11, 2008 10:20am
  •  hongkonger
  • | Joined Dec 2007 | Status: i am a hongkonger working in london | 54 Posts
Quoting magnumfreak
Disliked
unfortunately you can only sendmail not read it. One of the many limitations of mt4.
Ignored
Without checking this, it cannot be fully automated..scary..
 
 
  • Post #8
  • Quote
  • Apr 11, 2008 10:34am Apr 11, 2008 10:34am
  •  magnumfreak
  • Joined Nov 2007 | Status: Trying manual mode again | 2,210 Posts
Quoting hongkonger
Disliked
Without checking this, it cannot be fully automated..scary..
Ignored
About the only thing you could do to get around this would be to write a .DLL and create a function that reads the email folder. All incoming emails are stored in the email folder.
 
 
  • Post #9
  • Quote
  • Apr 11, 2008 10:45am Apr 11, 2008 10:45am
  •  hongkonger
  • | Joined Dec 2007 | Status: i am a hongkonger working in london | 54 Posts
Quoting magnumfreak
Disliked
About the only thing you could do to get around this would be to write a .DLL and create a function that reads the email folder. All incoming emails are stored in the email folder.
Ignored
Oh yes ! but they are encrypted.. any idea of how to decode it ?
 
 
  • Post #10
  • Quote
  • Apr 11, 2008 10:46am Apr 11, 2008 10:46am
  •  forextrader0
  • | Joined Jan 2008 | Status: Member | 83 Posts
Might be an easy question... but I thought the Forex only closed Friday afternoon till Sunday afternoon. Are you talking about not trading due to lower volume on a specific holiday, like say christmas? Thanks
 
 
  • Post #11
  • Quote
  • Apr 11, 2008 11:00am Apr 11, 2008 11:00am
  •  hongkonger
  • | Joined Dec 2007 | Status: i am a hongkonger working in london | 54 Posts
Quoting forextrader0
Disliked
Might be an easy question... but I thought the Forex only closed Friday afternoon till Sunday afternoon. Are you talking about not trading due to lower volume on a specific holiday, like say christmas? Thanks
Ignored
No, there can be bank holidays on weekdays ..
 
 
  • Post #12
  • Quote
  • Apr 11, 2008 11:44am Apr 11, 2008 11:44am
  •  hongkonger
  • | Joined Dec 2007 | Status: i am a hongkonger working in london | 54 Posts
Quoting magnumfreak
Disliked
About the only thing you could do to get around this would be to write a .DLL and create a function that reads the email folder. All incoming emails are stored in the email folder.
Ignored
Do you think that I can forward the system mails to another email address ? where I can have an email to sms service ? so that I dont need to automate it.. I wont know the email contents for different situations..

I cant find such setting...
 
 
  • Post #13
  • Quote
  • Last Post: Apr 11, 2008 12:35pm Apr 11, 2008 12:35pm
  •  magnumfreak
  • Joined Nov 2007 | Status: Trying manual mode again | 2,210 Posts
you may want to check out metatraders forum to see if anyone has info on how to read the emails with an ea or indicator.

I don't know of a way to forward emails that come into mt4.

Maybe the new mt5 will correct some of these limitations. It is due out soon.
 
 
  • Platform Tech
  • /
  • How to detect it's 2 hours before market close for the weekend ?
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023