Canadian stocks were higher on Tuesday as traders largely brushed off data showing weakness in the Canadian and Chinese economies.The S&P/TSX composite index gained 57.25 points to 15,034.17 after a string of losses has led to the main Toronto index heading for its first monthly decline in four months.The Canadian dollar was down 0.24 of a cent to a fresh, six-month low of 89.42 cents US.Statistics Canada reported that gross domestic product was flat during July following a 0.3 per cent rise in June. Economists had expected a gain of 0.2 per cent. The agency says there were notable decreases in mining and oil and gas extraction during July.U.S. indexes were higher amid other data showing deteriorating consumer confidence. The New York-based Conference Board’s index fell to 86 during September from 93.4 in August.The Dow Jones industrials were up 56.35 points to 17,127.57, the Nasdaq rose 10.12 points to 4,515.98 while the S&P 500 index climbed 5.39 points to 1,983.19.HSBC Corp.’s monthly purchasing managers’ index showed that China’s manufacturing activity in September held steady at the previous month’s low level, indicating the world’s second-largest economy faces risks to growth. The index came in at 50.2. Anything below 50 indicates contraction.Other Chinese data this month reported declining industrial production, lower property prices, weaker imports and pressure on factory prices, all of which added to concerns that outside of the U.S., global growth is faltering badly.“Without a doubt, we have slowing global economies and part of that is a deterioration in the rate of growth in China,” said Tim Caulfield, co-lead manager of the Franklin Bissett Canadian Equity Fund. “And we have seen that weigh heavily on energy and materials equities in September.”Traders have also been concerned that an improving American economy could persuade the U.S. Federal Reserve to move on raising interest rates sooner than expected next year.Positive U.S. economic data and Fed speculation have also helped strengthen the U.S. currency, which in turn have depressed commodity prices during September.A stronger greenback makes it more expensive for holders of other currencies to buy oil and metals, which are U.S.-dollar-denominated.The TSX is down about four per cent for September but still up around 10 per cent for the year. Caulfield observed that the TSX has registered gains in 11 of the past 12 months.“So when we do see a pullback, it’s not entirely surprising given the extent of the advance that we have seen in the current bull market,” he said.The industrials sector was ahead one per cent with shares in Canadian Pacific Railway (TSX:CP) ahead $3.83 to $232.41 after the company received approval to more than double the amount of stock it can purchase under its 2014-15 share buyback program, having reached the maximum available under the initial plan.November crude in New York declined $1.30 to US$93.27 and the energy sector turned up 0.65 per cent.The base metals sector on the TSX was up 0.35 per cent while December copper gave back four cents to US$3.02 a pound.The gold sector moved down 0.25 per cent as December gold faded $5.70 to US$1,213.10 an ounce.In other corporate news, Enbridge Inc. (TSX:ENB) CEO Al Monaco says the company is looking to diversify beyond its core North American oil pipeline business, eyeing opportunities to grow its presence in natural gas pipelines, power generation and internationally. Its shares climbed 28 cents to $54.09.