Hi,
in a realtime script I need to check if tomorrow is option expiry. Therefore I just wanted to use IsOptionExpiry function but the function needs Bars as input. Is it possible to create a function that uses a DateTime as input for IsOptionExpiry?
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Hi,
What the problem is with passing a future bar to the function in a realtime script? Could have suggested "use DateTimeToBar" but I'm curious.
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Hmm, I thought passing Bars.Count will result in an index out of bounds error? At least I had this error before posting the question. If the script runs on Bars.Count-1 how can I tell that tomorrow is option expir?
CODE:
Please log in to see this code.
?
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        CODE:
Please log in to see this code.
     
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Note quite as slick as Eugene's solution (though you'll still have to add a day to the current date)...  WealthScript Programming Guide > WealthLab.Rules Classes > OptionExpiryDate
CODE:
Please log in to see this code.
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Thank you!
    
    
        
    
    
        
    
    
        Size:  
    
        Color: