Welcome to TeX-SE! Your proposal works nicely if you use scale to scale the picture down.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\newcommand{\test}[1][]{\begin{tikzpicture}[#1]
\draw (0,0)--(1,1);
\draw (0,1) -- (0.5-0.05,0.5+0.05);
\draw (1,0) -- (0.5+0.05,0.5-0.05);
\end{tikzpicture}}
$X_{\test[scale=0.2]}$
\end{document}

However, often one wants to define a new symbol that scales with the text and becomes bold when the surroundings are, adapts the color of is ambient text and so on. Here is a way of achieving this with your command as starting point.
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\makeatletter
\DeclareRobustCommand{\checkbold}[1]{% https://tex.stackexchange.com/a/24635/121799
\edef\@tempa{\math@version}\edef\@tempb{bold}%
\ifx\@tempa\@tempb%
\def#1{1}%
\else
\def#1{0}%
\fi}
\makeatother
\newcommand{\somedrawing}{(0,0)--(0.7em,0.7em) (0,0.7em) -- (0.35em-0.07em,0.35em+0.07em)
(0.7em,0) -- (0.35em+0.07em,0.35em-0.07em)}
\newcommand{\myX}{\checkbold\tmp%
\ensuremath{\mathrel{%
\mathchoice{%
\tikz{\draw[line width={1.2*(1+0.33*\tmp)*0.06em}]\somedrawing;}
}{%
\tikz{\draw[line width={1.2*(1+0.33*\tmp)*0.06em}]\somedrawing;}
}{%
\tikz{\draw[line width={1.2*(1+0.33*\tmp)*0.045em}]\somedrawing;}
}{%
\tikz{\draw[line width={1.2*(1+0.33*\tmp)*0.035em}]\somedrawing;}
}}}}
\newcommand{\test}{\begin{tikzpicture}
\draw[line width=0.07ex] ;
\end{tikzpicture}}
\begin{document}
$X_{\myX}$ {\Large $\myX_{\myX}$} {\boldmath $X_{\myX}$ \textcolor{blue}{\Large $\myX_{\myX}$}}
\end{document}

Further information can be found in the answers to this question, and I am using the TikZy answer from there.
\documentclass{article} \usepackage{tikz} \begin{document} \newcommand{\test}[1][]{\begin{tikzpicture}[#1] \draw (0,0)--(1,1); \draw (0,1) -- (0.5-0.05,0.5+0.05); \draw (1,0) -- (0.5+0.05,0.5-0.05); \end{tikzpicture}} $X_{\test[scale=0.2]}$ \end{document}? – May 26 '19 at 22:47