X = sell price

B = buy price

A = amt invested in $

D = desired profit in $

S = Number of shares

I would like the formula to calculate variables X and S based on B, A and D. This will be a useful calculation for determing what I need to sell a stock at based on the known variables.

I want to write in a python program so if it can be broken down into multiple calculations that would be better.

Question/answer format would be such:

1. What is the buy price? I.e. $2

2. How much do you want to invest? $500

3. How much profit in $ do you want to make? $200

Your sell price for this amount is x

I can work it out based on percentages, but I prefer to use $ amt variables.

Cheers