Using a basic MACD as a signal this code is an example of how to base strategies around stops and calculated risk per trade rather than the more common approach of 'equity flipping' long and short for every trade and using an arbitrary %age stop which can leave you a bit exposed, lead to excessive drawdown and miss out on bigger sized positions for more profits.