Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How do I clean up my Algorithm?

I'm writing a basic algorithm that is based off the algorithm shell that is found in documentation. However I'm tweaking it a bit in the hopes of adding more equities to focus specifically on the technology sector. I have this block of code:

if data.can_trade(context.TEAM):  
        # If the current price is 1% above the 5-day average price,  
        # we open a long position. If the current price is below the  
        # average price, then we want to close our position to 0 shares.  
                if current_price > (1.76* average_price):  
            # Place the buy order (positive means buy, negative means sell)  
                    order_target_percent(context.TEAM, .15)  
                    log.info("Buying %s" % (context.TEAM))  
                elif current_price < average_price:  
            # Sell all of our shares by setting the target position to zero  
                    order_target_percent(context.TEAM, .15)  
                    log.info("Selling %s" % (context.TEAM)  

I have about 4 more blocks of this and I'd like to condense it, I'm tried nesting it however it seems like I'm either doing it wrong or it's not accepting what I'm used to writing.