DEFENSE: Some tips for good defense:
1) Spirits over at the forums has this: http://www.ageofempires.com/Forums/yaf_postst3496_Defense-forts.aspx
The essence of this post is that a good defense keeps, among others, two things in mind:
a) Buildings should be arranged in a compact fashion.
b) Try to have defense towers in a way that they protect not just other buildings but each other too. A good example for level 5, which worked well for the writer, (MonkArmy) was two catapults on either side of a CrossBow tower. Also, catapults covering the Archer towers. This way, a short range defense structure is covered against attack by short range and long-range troops.
Or Flame tower protecting the Trebuchet in Age 6. Flame tower is also very good at defending the Watch Signal.
c) Don't get too compact, some heroes in later levels can take use of that.
d) If you stack resources, you're bound to get attacked, especially stone. Hence, plan your upgrades such that you are stacking up only one resource at a time. e.g. If you're collecting wood and you're 80% of the way there, then before logging off try to use up your stone and food. A good stone use is upgrading your walls. For food, one good idea is to leave enough to resume attack next day and use up the rest by either building an honor item, or just going through the attack list but not attacking anyone. Remember you will need one building slot free if you're trying to build honor item or upgrade a stone wall.
e) Available loot depends on your crowns, specifically the crown difference between you and the attacker. Keep this in mind. One way to do this is, when you are skeptical of being attacked, is to choose higher crowned players in the hope that they won't find your resources too tempting if the available loot is too little. This has the downside of the possibility of your castle getting wiped out for a 100% loss if the defendant chooses to revenge you. Another way is to drop crowns artificially.
f) If there's a particular resource you care about then make those resource containers your most defended structure and move out your keep to a less defended place (not completely undefended). Hopefully attackers would not take the pain of getting to your most protected area once your keep is down, and you will get a nice peace treaty.
g) Try to keep gates upgrade more than walls because 1. many attackers go for the gates and 2. rams automatically target them.
h) Please do not try to stay online using artificial means. It's not fun. You don't get imaginary in-game gold for staying on top of the leaderboards, let alone real gold. So no point in ruining your own fun and others' too. Also, if you get caught (which almost always happens), you'll lose your entire progress.