Actually, you don't need to avoid it, if we know how to deal with a sideways market it is even profitable, when the market is in a sideways position, of course there are lots of strategies and systems that are profitable in a sideways market, one of which is the hedging transaction strategy.
Where we can do hedging and averaging when the market is in a sideways condition.