I am going to set up a closed investment company mainly for stocks (and eventually property) investments. Now, let's say I will invest in stocks and I will not cash out in the first tax year period, am I right to say the profit is 0 so the tax is also 0? Only when the company will make profit (in this case selling the stocks hopefully grown) and then I have to pay taxes.
Just to add to DaleM's answer: as well as deducting allowable expenses, dividends are taxed as part of one's total income after taking in to account the relevant Personal Allowance and Dividend Allowance:
You do not pay tax on any dividend income that falls within your Personal Allowance (the amount of income you can earn each year without paying tax). [£12,570 for 2021/22]
You also get a dividend allowance each year. You only pay tax on any dividend income above the dividend allowance. [£2,000 for 2021/22]
A company pays tax on taxable profit
That is, taxable revenue less tax deductible expenses. Not all revenue is taxable and not all expenses are tax deductible. Capital gains are also taxed differently from normal revenue.
If the company invests in stocks (by which I assume you mean shares in publicly traded companies and not herds of cattle or flocks of sheep), most of these will pay semi-annual dividends. These are taxable revenue and, subject to any deductions, you will owe tax on them.