In addition to what Jame Christopher said. You are putting the buy outside the loop meaning that you are only checking the last stock in the loop and its always evaluating to true for reasons James said... so you are always setting your portfolio to 100% of the last stock so nothing is bought sold.
In the code sample below I have changed it to buy equal weights of all things that have been flagged to buy with a few simple changes however your current flag is set to always buy so it will just equally weight the entire portfolio.
buy_these = []
for stock in data :
volume=history(5,'1d','volume') #volume of last 5 days
volume=data[stock].volume
vol_significant=volume*1.5
ma5=data[stock].mavg(5)
buy_threshold=ma5*1.05
if buy_threshold>ma5 and vol_significant>volume :
buy_these.append(stock)
buy_count = len(buy_these)
pct_per_stock = 1.0/buy_count
for stock in buy_these:
order_target_percent(stock,pct_per_stock)
log.info("Buy yeah" + str(stock))
Did you want to buy if the price is is greater than the 5 day moving average and the volume is greater than the 5 day moving average?