Three tile wide paved ramp coming in from the map edge. Past the initial guard dogs the passage widens, then divides into three three tile wide corridors running side-by-side. Corridors are floored with bridges, thirteen 10X3 bridges in each, over a ten Z-level-deep drop. Alarm dogs are chained in alcoves in the walls to spot thieves. Then the corridors rejoin, pass a final set of barrier bridges and alarm dogs, and then enters my trade depot.
When I am expecting a caravan, the system is idle. Trade convoys spawn at the entrance and make their way down the central isle to the trade depot. But because ambushes seem to spawn at about the same time, as soon as the trade convoy is in I activate it. I learned the hard way that having a defense system that requires half a dozen widely scattered levers to be pulled in the right order is a bad idea. For this fortress, a single lever in the center of the meeting hall controls the entire defense system, and I always make sure to have an idler ready to pull it.
Pulling the lever opens a floodgate deep in the bowels of the fortress, letting water flow out of base of the ten level deep cistern. The rivers, my only source of water, freeze during winter, so I made sure to keep enough water on hand to run the defenses for several years if necessary. The water flows into a complex system of pressure plates, floodgates, and bridges that controls the entire defense system timing.
First the barrier bridges closest to the trade depot retract. Those bridges are to prevent any dwarves, traders, or animals from wandering into the defenses while active. They're retracting over a one-level-deep channel, so anyone on them when they open isn't hurt and can make it back to the trade depot chamber.
Then barrier bridges raise around the guard dogs at the entrance, and a one tile wide side path opens up. I got tired of having to replace the entrance dogs every time an ambush came by, so when the defensive array is in kill everything mode I seal them off and shunt traffic around them.
Then the main system engages. Each of the three corridors' bridge floor arrays open and close in sequence. The system is set up such that at any one time at least one of the bridges will be solid and offer a valid path to the bait dogs at the other end. The timing of the system is slow, taking over 600 cycles for all the bridges to run through a full on-off cycle, but at 130 tiles long nothing's made it all the way across. The ten Z level drop is explosively fatal to everything that I've seen so far. I have yet to have a siege or megabeast, but the system has killed ambushes, babysnatchers, kobold thieves, and random wild animals. Someday I'll get around to cleaning up some of the bones, armor, and weapons littering the channel under the bridges.
While the defense array is running, my dwarves will be trading with the convoy, blissfully unaware of the carnage going on. By the time I get the "Traders will be leaving soon" message the entrance is generally clear. I send a dwarf to pull the lever again. The floodgate from the cistern closes, and drain gates open up to drain the water from the control logic. The main bridge arrays stop cycling and go solid. The barriers around the guard dogs open, and only when everything is safed will the safety bridges near the trade depot allow passage.
This fortress has no military. I have only had two deaths so far: a legendary miner, one of the original 7, who died in an unfortunate accident while digging out my cistern, and an immigrant hauler who insisted on going for a stroll outside and got ambushed.
(edited to fix math error)