Trading is not gambling as long as it involves risks. Risk the critical factor in every business. As no risk no reward. Furher it depends on your definition how do you separate legal from Illegal in most jurisdication gambling is illegal so, a trade involving gambling would also be illegal,