The IRS expects a gain for three out of five years. If you do not have one, they start to suspect that you don't have a profit motive.
IRC § 183(d) is a safe harbor for the taxpayer. It allows a presumption that the taxpayer is engaged in for profit if in 3 of 5 consecutive years (2 of 7 in the case of breeding, training, showing or racing of horses), the activity is profitable.