This paper presents the results of a novel mathematical and experimental analysis of two approaches to margining customer accounts, strategy-based and risk-based. Building combinatorial models of hedging mechanisms of these approaches, we show that the strategy-based approach is, at this point, the most appropriate one for margining security portfolios in customer margin accounts, while the risk-based approach can work efficiently for margining only index portfolios in customer mar-gin accounts and inventory portfolios of brokers. We also show that the application of the risk-based approach to security portfolios in customer margin accounts is very risky and can result in the pyramid of debt in the bullish market and the pyramid of loss in the bearish market. The results of this paper support the thesis that the use of the risk-based approach to margining customer accounts with positions in stocks and stock options since April 2007 influenced and triggered the U.S. stock market crash in October 2008. We also provide recommendations on ways to set appropriate margin requirements to help avoid such failures in the future.