Wait until January when you get the Form 1099-B for the sale. With luck, it will show the basis (cost) of the stock that you sold, so all you have to do is enter the 1099-B in your 2018 tax return. You can enter "Various" for the purchase date.
If the 1099-B does not show the basis, you will have to figure it out. From the way you worded your question I assume that you sold stock in a company, not a mutual fund. If you sold all the shares that you owned, just add up the purchase price of the original shares plus the dollar amounts of all the reinvestments. The total is your basis. If you only sold some of the shares, each group of shares that you purchased is a separate lot. You have to add up the purchase prices of the lots that were sold. You are assumed to have sold the oldest shares first. TurboTax Premier will help you with this. On the screen where you enter the information about the sale, click the button that says "Guide me step-by-step." On the next screen select "My sale involves one of these uncommon situations." They consider needing help calculating the basis to be an uncommon situation. Then proceed through the screens and enter the information that is requested. You will come to a screen where you enter the purchase information for each lot.
Wait until January when you get the Form 1099-B for the sale. With luck, it will show the basis (cost) of the stock that you sold, so all you have to do is enter the 1099-B in your 2018 tax return. You can enter "Various" for the purchase date.
If the 1099-B does not show the basis, you will have to figure it out. From the way you worded your question I assume that you sold stock in a company, not a mutual fund. If you sold all the shares that you owned, just add up the purchase price of the original shares plus the dollar amounts of all the reinvestments. The total is your basis. If you only sold some of the shares, each group of shares that you purchased is a separate lot. You have to add up the purchase prices of the lots that were sold. You are assumed to have sold the oldest shares first. TurboTax Premier will help you with this. On the screen where you enter the information about the sale, click the button that says "Guide me step-by-step." On the next screen select "My sale involves one of these uncommon situations." They consider needing help calculating the basis to be an uncommon situation. Then proceed through the screens and enter the information that is requested. You will come to a screen where you enter the purchase information for each lot.