Yes, you are correct.
This method is called "chaining"
The way you do this is by using your Pokeradar you battle pokemon you find in the moving grass. As you battle the pokemon your chain increases until 40 where is levels out and stops. Your chain can be broken if you battle a pokemon that you didn't find in the moving grass. Once you see a patch of grass that's sparkling walk to it and it should be a Shiny pokemon.
I recommend using repels so you won't encounter unnecessary battles.