As mentioned in the comments, bridges are useful -- keep them lowered normally, but raise/retract them during sieges or when an ambush is detected (On that note, patrols and watchtowers help a lot to spot an ambush before it knocks on your door).
Another major help are staggered walls -- a few twists and turns in their path won't annoy the traders unduly, but breaking line of sight early and often makes enemy archers much less threatening (given that their ranged fire tends to amount to 70% of my total casualties on average if I don't make sure I can take them out of the equation, this is a big consideration).
On that note, you can significantly improve your fort's security by keeping a few facts of the AI in mind and mechanics in mind:
- Its pathfinding routine is essentially clairvoyant when it comes to routing, but it doesn't see traps;
- This means that it will choose a trap-studded one-tile-wide suspended floor path that leads almost straight into the fortress over an open corridor that's significantly longer to walk through;
- A trap only becomes "stuck" if it fatally injures something -- IE, when the wound is immediately fatal. A trap that 'merely' removes a limb or cuts through enough tissues to cause fatal blood loss won't need to be cleaned for the next victim to come across it;
- An enemy that makes its reflex saving throw and dodges the trap automatically moves into an adjacent untrapped tile -- even if the only tile matching those criteria happens to be over empty air;
- Once you have magma furnaces going, and an on-map source of sand, green glass upright menacing spikes and green glass serrated discs are essentially free.
Here are a few ways to bring these facts together in fun and interesting ways to cause many, many enemy fatalities:
The Long Walk Off A Short Pier: It's not a proper fortress until you have a decent moat along your walls, so I'm taking that as given. You don't need to fill it up yet, either. Aside from the wide drawbridge-covered main entrance, build one or more one-tile-wide floor paths over the moat, then build a one-weapon trap on each tile... And built upright spike traps on each tile to either side of the walkway in the moat below. Result: When a goblin manages to dodge the trap, he'll "dodge" right off the side and onto the spikes below. If the fall doesn't kill him, well, having made sure that the only upward slopes are on the outer edge of the moat means he has to climb back out and try going over that trapped walkway again.
Circular Reasoning The pathfinder AI instantly detects any changes in pathing due to doors opening and closing, so if you have a trap-filled corridor that has two gated entrances into your fort, and a set of pressure plates near each gate that causes the near gate to close and the far gate to open when enemies step on it... Let's just say it can keep your uninvited guests entertained for ages. Or until you run out of guests.
Flushing: This one requires a decent amount of power and a lot of pre-planning. Build a large reservoir of water (or for advanced mad scientists, magma) several Z-levels above the river/creek. Use built walls, floor grates and dug channels to make sure the outflow pours into one end of a long corridor and out the other, then rig up pressure plates to link to floodgates that seal the corridor and open the reservoir when an enemy steps on them. This setup is definitely for advanced mad scientists, as minor mistakes in planning can very easily lead to flooding your entire fortress by accident. Remembering the game's motto is recommended.
The wiki has a large page on trap design. Including a few good ways to potentially increase fun. My advice, make a flamethrower bunker.
EDIT: Almost forgot; you don't need to have the trade depot inside the fort proper; just be sure to secure the perimeter -- it's a diplomatic faux pas to let raiders destroy friendly caravans.