Degrees of Freedom and Curve Fitting Risk in Trading Systems

What is the relationship between degrees of freedom in a model and trading system curve fitting risks? Learn the maths, the warning signs and how to fix it.