The designers didn't like stalemates so no, you can't exactly do that, but the 5-turns on Hold/Guard is the closest and usually works pretty well for what you want.
Also you can get a stationary force if you want to, even around a commander set to Attack (as long as they can't fly). If you have enough troops set to Guard, they will engulf that commander, who then cannot move, and none of them will go anywhere.