I have an intraday strategy that sometimes exits at the close of a trading session. Typically, it is 15:59. But, on days before the US holidays, it can be 12:59. I would like to find a code that would tell me the closing time of a session, both for the past and future dates. Thanks in advance.
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Got it working. The code
CODE:
Please log in to see this code.
     
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        You can make this quite a bit more robust by reading Application.UserAppDataPath + @"\Data\Markets.xml" to get the special hours info.
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Do you know why the day before July 4th isn't special hours but only 2009?
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Not really, but my guess is that it's because the 4th, normally a market holiday, is on a Saturday this year.
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        QUOTE:
You can make this quite a bit more robust by reading Application.UserAppDataPath + @"\Data\Markets.xml" to get the special hours info. 
Thanks, but I did not understand. I am still learning WL5 scripting language and would appreciate if you explain what you mean by <<reading Application.UserAppDataPath + @"\Data\Markets.xml">>. If it is not too much trouble, can you please show a working code of getting the special hours info. Thanks in advance.
    
 
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        This programming subject requires a little knowledge of XML processing in C#. Here's an example for you that will highlight shortened session dates. But firstly, make sure to click "References" and having checked "
System.Xml" in the dialog. You'll need to do that for every strategy where you'd like this code to be used.
CODE:
Please log in to see this code.
     
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Great! Thanks a lot!
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        And how to modify this code, to get info about Holidays from Markets.xml file?
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Have you already tried and came up with something that we could correct?
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        CODE:
Please log in to see this code.
     
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Nice attempt. Especially considering that your trial has expired in May, and even a 'replacement' trial that you took under the name 'misirlou' - which we consider to be an unfair, cheater practice - has also expired in June.
Change this:
CODE:
Please log in to see this code.
To:
CODE:
Please log in to see this code.
And then, replace this line:
CODE:
Please log in to see this code.
With this one:
CODE:
Please log in to see this code.
Enjoy.
    
 
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Thanks.
And is there a way to check if current day is short term session?
P.S.: I want to buy a license, as soon as I will be sure, that I can use it 100%.
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        QUOTE:
And is there a way to check if current day is short term session?
This is just what this line of code does:
CODE:
Please log in to see this code.
Since "Today" stands for Bars.Count-1, you'll need to add a check for 
bar == Bars.Count-1.
As you understand, it applies to code in my message from 5/27/2009 4:14 AM (or in Community.Components).
    
 
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Understand, thank you.
    
    
        
    
    
        
    
    
        Size:  
    
        Color: