I have used the armed merchant (Q-Ship) concept on occasion with varying results. The only time I build them is when I have no more military yard capacity to spare. Having to either build the warships or divert existing units to babysit shipping sometimes is not possible. Having DD's, FR's, and/or CL's to patrol the shipping lanes is the ideal solution, but not always feasable. In those times I will use non military shipyards to construct or quick-buy Q-Ships. Non-military as in not enough production capacity to churn out naval vessels in reasonable time. I make the Q-Ships cheaper and quicker to build than any warship (that's the point, right?). They often enough do just enough damage to cause the enemy to withdraw after a couple of them have been tangled with. Attriting the enemy's warships for a fraction of the cost of a real warship is nice, but the real trick is to make it cost effective. Sure, I could over-engineer a nightmare of a Q-Ship that could rival any Dreadnought in all but hitpoints, but the maintenance alone on such a monstrosity would negate the value of the trade route to a large extent, or even completely in some cases.
The real way to protect shipping is not by band-aid solutions forced upon our forefathers by the exigencies of war, rather it is by providing safety in numbers with properly escorted convoys. A submarine may succeed in sinking a freighter or two out of a convoy before being either destroyed or chased away by the escorts, but lone freighters steaming away on a predictable course one after another will result in defeat in detail. A screw up by the numbers, per se.