Abstract In a recent study, Schulenburg and Ross (2001) proposed the LCS for short-term stock forecast. Studley and Bull (2007) proposed the extended classifier system (XCS) agent to model different traders by supplying different input information. Announcement made by Morgan Stanley Capital Investment (MSCI) regarding the additions, removals, and even the weights of the component stocks in its country indices every quarter generally would cause changes to the prices and/or trade volumes of the associated component stocks. This paper takes an XCS in artificial intelligence to dynamically learn and adapt to the changes to the component stocks in order to optimize portfolio allocation of the component stocks. Since these price trends of MSCI component stocks are influenced by unknown and unpredictable surroundings, using XCS to model the fluctuations on financial market allows for the capability to discover the patterns of future trends. This simulation works on the basis of the changes to 121 component stocks in the MSCI Taiwan index between 1998 and 2009 suggests the XCS can produce the great profit and optimize portfolio allocation.