Here's yet another way of doing this.
We can be in one of $5$ states, according to the number $0\le k\le4$ of consecutive “correct” results that we currently have; e.g. $k=2$ means the last two results were HT. Let's make a graph with the transitions between these states:
The labels on the vertices are the values of $k$. We'll get to the edge weights in a bit. In addition to the two possible transitions from each of the nodes with $0\le k\le3$, I added an edge from $4$ to $0$ to complete a round trip from $0$ to $4$ and back.
The idea is to choose the edge weights such that at each vertex all outgoing edges have the same weight and the sums of incoming and outgoing edge weights are equal. For instance, start at $3$ and arbitrarily assign weight $1$ to its outgoing edges; then work your way around the graph, e.g. it follows that the edge $4\to0$ also has weight $1$, the edge $2\to3$ has weight $2$, thus the edge $2\to1$ also has weight $2$, and so on. You barely have to compute anything.
Now consider a process on the edges where in each step we go from the current edge to its terminal vertex and then uniformly randomly choose one of its outgoing edges. Then the equilibrium distribution on the edges is given by the edge weights, normalized by their sum, since by construction that lets the same probability flow into and out of each vertex in each step.
We're looking for the expected time to reach $4$ from $0$. After we reach $4$, we always go to $0$ in a single step. Thus, the time we want is $1$ less than the expected time for a round trip from $0$ to $4$ and back. On such a round trip, we spend exactly $1$ step on the edge $4\to0$. But then the expected time for the round trip must be the reciprocal of the equilibrium probability of being on edge $4\to0$. Since that edge conveniently has weight $1$, the expected time for the round trip is just the sum of the edge weights, which is $19$. Thus the expected time to get from $0$ to $4$ is $1$ less, $18$.