A business owner’s decision to sell his or her company is often based on a mix of factors. Perhaps the knees are starting to creek more than they used to and it’s time for a change, or maybe a potential buyer makes an offer that’s too good to pass up.

But the biggest factor of all is timing. If you aren’t careful, you may end up selling at a time when your industry is declining or the economy is in a downturn. In those cases, you’ll miss out on the maximum possible sale price for your business.

Ideally, you’ll want to sell your business at or near its peak, when industry and market trends are on the upswing. This is the best way to ensure that you get a maximum sale price for your business.

Another factor that plays a role in the optimal time to sell is the availability of financing. When access to capital is constrained, it’s harder to sell a business because buyers don’t have the cash to make the acquisition.

As you decide whether it’s the right time to sell your business, you’ll also need to consider how much you are willing to remain involved in the business following the sale. Structuring a deal that allows you to stay on as a senior executive or advisor helps smooth the transition to new ownership and can maximize the sales price for your business. This is especially true if you can continue to help the business maintain its quality, brand and mission statement under new ownership.