Below is an example of some code I have in the script that I am working on.
// See if there was a change in long-term trend
if ( weekly_ema[bar] > weekly_ema[bar-5] )             // Note that these bars are daily bars.
	upTrend = true;
else if ( weekly_ema[bar] < weekly_ema[bar-5] )
	upTrend = false;
In this example, weekly_ema was computed after setting the time scale to weekly.  Then the daily time scale was restored and a synchronize was performed.  It seems that the above code would work fine if every week had 5 market days in it.  But with market holidays, that is not the case and so it would seem that the above code does not do precisely what I want it to do.  Is there a standard way to compare weekly data for one week with the weekly data for the previous week when one is in a for loop on a daily time frame?  Otherwise, I've been trying to come up with various kludges that might work.
Thanks,
Dave
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Yes, there is a way to compare weekly data for one week with the weekly data for the previous week:
GetWeeklyBar
     
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Thanks.  I'll give that a try.
Dave
    
    
        
    
    
        
    
    
        Size:  
    
        Color: