Pseudoknots have generally been excluded from the prediction of RNA secondary structures due to its difficulty in modeling. Here we present an algorithm, dynamic iterated matching to predict RNA secondary structures including pseudoknots with O(n4) time. The method can utilize either thermodynamic or comparative information or both, thus is able to predict pseudoknots for both aligned and individual sequences. We have tested the algorithm on a number of RNA families. Comparisons show that our algorithm and loop matching method has similar accuracy and time complexity, and are more sensitive than the maximum weighted matching method and Rivas algorithm. Among the four methods, our algorithm has the best prediction specificity. The results show that our algorithm is more reliable and efficient than the other methods.