How would I code A stock that reaches a 52 week high and within x period goes down by 10 % or more and goes back up lets say to within 2 pct of the 52 week high. 
What I am having trouble with is the sequence in the timing :
First 52 week high
then 10Pct down 
Then back up 
within certain period. 
Thanks. 
Regards. 
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Here you go:
CODE:
Please log in to see this code.
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Any way to delimit the time of the v such that this pattern has to occur in 10 days? 
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Thank you for saying thank you.
Yes, what you have to do is simply calculate the difference between the highBar and the bar before the buy order.
    
    
        
    
    
        
    
    
        Size:  
    
        Color: