Gilbert has the 10th healthiest housing market among American cities with a population of more than 200,000, according to a new study.

Smart Asset, a technology company that provides personal finance advice online, ranked Chandler and Mesa ahead of Gilbert, placing them at fifth and seventh place, respectively.

“Homeowners in a healthy market should be able to easily sell their homes, with a relatively low risk of losing money,” Smart Asset said.

To determine market health, the site analyzed stability, affordability, fluidity and risk of loss.

It said it based the stability rate on the average number of years people own their homes and the percentage of homeowners with negative equity.

“To measure risk, we used the percentage of homes that decreased in value. To determine housing market fluidity, we looked at data on the average time a for-sale home in each area spent on the market — the longer homes take to sell, the less fluid the market,” the study said.

It based its affordability calculations on the monthly cost of owning a home as a percentage of household income.

Affordability accounted for 40 percent of the healthiest markets index, while each of the other three factors accounted for 20 percent, Smart Asset said.

The site said Buffalo, New York, had the healthiest housing market, followed by Lincoln, Nebraska; Fremont, California; and Durham, California. The other cities in its top 10 were Colorado Springs, Colorado (6); Raliegh, North Carolina (8); and Glendale, Arizona.

For Gilbert, the site said owners live an average nine years and two months in their homes versus a national average of 12 years and two months.

Only 2.8 percent of homes have decreased in value, the study said, as opposed to 18.8 percent nationwide.

Homes stay on the market an average 64 days in Gilbert, Smart Asset said, as opposed to 82 days nationwide.

And Gilbert homeowners devote 21.1 percent of their annual household income toward their home — from mortgage and insurance to maintenance costs. That compared favorably to an average 21.1 percent of annual income that homeowners nationwide pay toward owning their house.