lets do a though experiment :
how gambling works :
you pick an option, place your bet, the deciding event happens, there is a pay out or you loose.
A binary win/loss state
how stock trading works (assuming you do a flip a coin level betting) :
you pick an option, place your bet, the deciding event starts to happen; if it going your way, you hold, else you close the bet early (statistically a robot that places a hedged bet on the market and then closes the one that is making a loss should always win by momentum at small margin, so go figure)
so yea, stock trading is gambling for smart people