The context tree weighting (CTW) algorithm [Willems et al., 1993] has high compressibility for universal coding with respect to FSMX sources. The present authors propose an algorithm by reinterpreting the CTW algorithm from the viewpoint of Bayes coding. This algorithm can be applied to a wide class of prior distribution for finite alphabet FSMX sources. The algorithm is regarded as both a generalized version of the CTW procedure and a practical algorithm using a context tree of the adaptive Bayes coding which has been studied in Mataushima et al. (1991). Moreover, the proposed algorithm is free from underflow which frequently occurs in the CTW procedure.