Max pain is a simple but time consuming calculation. Essentially, it is the sum of the outstanding put and call dollar value of each in-the-money strike price.
For each in-the-money strike price for both puts and calls:
Find the difference between stock price and strike price
Multiply the result by open interest at that strike
Add together the dollar value for the put and call at that strike
Repeat for each strike price
Find the highest value strike price. This price is equivalent to max pain price.
Because the max pain price can change daily, if not from hour to hour, using it as a trading tool is not easy. However, it is sometimes valuable to note when there is a large difference between the current stock price and the max pain price. There could be a tendency for the stock to move closer to max pain, but the effects may not be meaningful until expiration approaches.
Example of Max Pain
For example, suppose options of stock ABC are trading at a strike price on $48. However, there is significant open interest on ABC options at strike prices of $51 and $52. Then the max pain price will settle at either one of these two values because they will cause the maximum number of ABC's options to expire worthless.