Position sizing is the process of determining how many contracts to trade, or shares to buy, or size of spread bet when you are trading on financial securities so that you have a good chance of achieving your trading objectives. Usually it is used to adjust the size of trades so that a worst case series of losing trades will not wipe out your account or render it inoperably diminished, but there are other factors that can be plugged in to suit your financial position and risk tolerance.
Before going into any more detail, it must be pointed out that this is just a statistical exercise, which if done thoroughly can yield good results, but as no-one knows exactly how the markets will act in the future it cannot give a guarantee. Position sizing can be done in various ways, and there is usually a parameter that can be adjusted, which will allow you to optimize the outcome, based on your stated objectives.
For instance, with fixed fractional position sizing the factor is the percentage of the account that can be risked on any one trade, often taken empirically as 2%. With fixed ratio position sizing, the variable is called the delta, the amount that the account has to increase so that you can take on another contract. When you optimize the value, which you do by reference to past performance, you can choose to have constraints which cannot be violated, while you also have an objective, which is what is optimized.
For example, a constraint might be that you do not want to have a drawdown on the account of more than 20%. In other words,the account will never be less than 80% of the maximum account size that you have made. This cannot be guaranteed, but statistically you can set up the position sizing optimization so that it should never happen in the future, based on typical performance in the past. The objective, frequently, is to maximize the return while respecting and complying with the constraint. Another objective might be a specific return or profit which allowed a smaller drawdown for safety.
Once the type of position sizing, the constraints and the objectives are worked out, then it is simply a matter of setting a back test to work, analyzing hundreds or thousands of results for different parameters. This is subject to all the caveats that you have with any sort of back testing, but if the data sample size is sufficient should give decent results.
If you go into it in more detail, you will find a number of ways of using the sample data to optimize the value. Some people will suggest that you split the sample data, covering a long time such as five or ten years, into two batches, using one batch to generate an “optimal” value, and the other to test it. You will never get exactly the same results, but this checks whether you have optimized the position size too specifically to the data that you have. If the result is repeatable on other data, then you can consider the optimization of the position sizing done.