Stance detection is one of the promising areas of computational linguistics, the task of which is to automatically recognize the author's viewpoint on the target object. In our study, to detect the stance, we propose the Ensemble-based Stance Detection method (ESD). First, we calculate the optimal number of features that are most relevant to the given domain based on the function approximating the dependence of F1-score on the number of features. Then we form a relevant feature set using the homogeneous ensemble of feature selection methods. At last, we build the optimal composition of classifiers using the crossvalidation procedure. Furthermore, we study the impact of various feature types on the performance in the stance detection task. The proposed ESD method is evaluated on the SemEval-2016 text corpus of tweets and the UKP Sentential Argument Mining corpus, and it outperforms the state-of-the-art systems.