Your approach is correct but where do the numbers come from?
Is the 18,000 the capital cost of the machine? If it is then you do not use the full amount you amortize this over what you expect is the life of the machine. For instance if you expect it will need replacing in three years then the annual cost is 6,000 plus some added percentage to cover the fact that you have money tied up in the machine not earning interest in an alternate investment.
And what is in the 5000 overhead? Does this include the wages you pay yourself?
Also you have to be careful you take into account that your machine will not be earning money every hour so you have to add a percentage to cover none productive time.