\documentclass[a4paper,12pt]{article}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{xepersian}
\settextfont{XB Zar}
\setlatintextfont{Times New Roman}

\begin{document}
تست

\begin{LTR}
\begin{algorithm}

	\caption{\rl{این یک الگوریتم تست است.}}
	\label{alg:PipelineDetectionPseudo}
	\KwData{this text}
 \KwResult{how to write algorithm with \LaTeX2e }
 initialization\;
 \While{not at end of this document}{
  read current\;
  \eIf{understand}{
   go to next section\;
   current section becomes this one\;
   }{
   go back to the beginning of current section\;
  }
 }
\end{algorithm}
\end{LTR}

\end{document}