When do you take a profit

I'm kinda kicking myself for not taking a profit when I was up about 40%. Still end up 19% so there is a positive.

But I'm curious when do you take a profit and how do you determine when to ride the wave up.

*Edit this is in reference to options, in particular LEAPS