I decide to buy when I believe in the stock. it's important to understand the workings of the company and what they dabble in. if I believe in their technology, I will buy their stock as an investment and support for their dealings.
as for selling, it depends on what I want to achieve. there are some stocks which I buy for profit taking, hence I typically sell when I feel I have made some profit. it is never wrong to take profit at any point in time. the most important thing is not to fear missing out, and not to sell when there is a dip. long term studies have shown that in general, long term investors do profit. hence invest what you can afford to lose.