This is generally true. Stocks go up when the economy is doing well. When the economy isn't doing well, investors usually pull out of stocks (causing stock prices to fall) and invest in bonds instead (which causes bonds prices to go up).