We propose a three-state microscopic opinion formation model for the purpose of simulating the dynamics of financial markets. In order to mimic the heterogeneous composition of the mass of investors in a market, the agent-based model considers two different types of traders: noise traders and contrarians. Agents are represented as nodes in a network of interactions and they can assume any of three distinct possible states (e.g. buy, sell or remain inactive). The time evolution of the state of an agent is dictated by probabilistic dynamics that include both local and global influences. A noise trader is subject to local interactions, tending to assume the majority state of its nearest neighbors, whilst a contrarian is subject to a global interaction with the behavior of the market as a whole, tending to assume the state of the global minority of the market. The model exhibits the typical qualitative and quantitative features of real financial time series, including distributions of returns with heavy tails, volatility clustering and long-time memory for the absolute values of the returns. The distributions of returns are fitted by means of coupled Gaussian distributions, quantitatively revealing transitions between leptokurtic, mesokurtic and platykurtic regimes in terms of a non-linear statistical coupling which describes the complexity of the system.