This is possibly a dumb question, but anyway...
I think your question is not only not dumb, it raises issues that would take a genius (someone far, almost infinitely more intelligent than myself!) to adequately address in terms of an overall account (and evaluation) of market economies, their values and the different roles they sustain and require. Moreover your question may require some account of what is involved (in the relevant sense) in creation, achievement, investments, and risk-taking (or what you refer to as gambling). Given the complexity of such background concerns, it seems virtually impossible to avoid replying to your question with something like: 'Maybe. Maybe not. It all depends....' I will attempt something that is a tiny bit more informative but without getting into the essential background concerns that really are essential for thinking more deeply on your excellent concern. Let me try, then, two responses, the first being quite general, the second more personal.
THE GENERAL RESPONSE: Assuming we are in the context of a free market economy and the trading is both practiced legally (no deception, double-dealing, duplicity) and the trade is in goods that not unjust (the trading does not involve arms dealing with terrorists, drug, sex, and endangered animal trading, etc), the production, transporting, sail and purchase of such goods often requires some reliable financial investments from those who are not involved in the production, transporting, etc of goods. There is, then (and forgive me if I am the dumb one in terms of simplification) often an essential place for persons to manage investing (of their own monies of those of clients) in those who are (more directly) involved in the creation of such goods. So, assuming that such a market economy is just (or not unjust), there seems nothing immoral (and perhaps something admirable) in those who invest in this process.
A SECOND RESPONSE: The way you phrase your question leads me to think that your worry is that the kind of trading you have in mind is not principally a dignified practice in a market economy, but the equivalent of going to a casino or betting on horses, playing lotteries, and the like. Two thoughts: first, I suggest that buying and selling shares in, say, IBM is very different from casino gambling (the first does contribute to the production of goods), but, second, even if the trading is like casino gambling it may only be immoral insofar as this involves the "trader" neglecting other, stringent moral obligations (e.g. the trader is actually a highly trained medical doctor who is needed to heal others but he has decided to break his contract with a hospital in order to engage in gambling and heavy drinking!). A third option is worth considering: imagine the trader's work is akin (ethically) to casino gambling, but the person is extremely good and gives millions of dollars each year to support Habitat for Humanity and provide scholarships for young persons to study philosophy in universities and colleges throughout the world. If you are such a trader, I wish to encourage you in every respect.