Stop loss is usually calculated by determining support and resistance.
we see previous support levels when we are into buy position, and that support zone will be our stop loss.
And if we are into short position, resistance levels will be our target.
Consider this example :
Tatamotors came down till 415, (marked as 1)
It went up taking support, thus it is said to be a support level,
again when it was crashing down, our stop loss will be same as 1 (415),
and we see that tatamotors exactly comes down to 415 and rebounds taking a support. (marked as 2)
In this way you can calculate support and resistance levels and can keep SL & TARGET.
hope this helps you.