The gambler's fallacy is the name behavioral economists give to the widely held but erroneous belief that a fair coin flipped heads 2 or 3 times is more likely to come up tails on the next flip (it isn't, since each flip is statistically independent of the one prior and is always 50%). However, markets, unlike coins, have memory because the market participants have memory.
They know the prices they bought and the prices they would like to sell (or if short, the prices at which they would like to cover). Plus, there are literally millions of participants all of whom have different, sometimes complimentary sometimes contradictory, objectives and time frames. The smart money, usually large hedge funds or investors, are trying to establish or exit positions without showing their cards all at once. But inevitably, although certainly not obviously, the charts tell a story. What usually happens it that when a trend first changes, for whatever reason, most people refuse to admit or recognize it has actually changed. But when certain trend lines get broken, some traders jump in and try to call a bottom (in the case of a downtrend changing). The early ones are almost always disappointed, or perhaps exit quickly for a short, quick profit, and the market falls back to its old lows right before the breakout. Some early investors who thought they were lucky or smart now regret their decision, promising to sell if its clear that the downtrend is resuming, which is usually at or around (or usually slightly below) the last prior low. As all those who want to sell do, whatever main trend was causing the turnaround (usually some fundamental news or trend) becomes more obvious, and people who noticed that the market is holding at its prior lows jump in and start to buy. This causes others who are more skeptical but missed the last rally to jump in and so on. At each higher price level, it becomes clear that something has changed and since the market is nothing but the collective perception of all of its participant observers, something does indeed change and the market starts moving smartly higher. This time, it may pause at the high of the last rally, but tends to hold there. More aggressive traders add to their positions, especially as the highs are held or broken and finally as it becomes obvious to everyone that the trend has changed, many pile on, driving the market up to often twice as high as the prior rally before something - who knows what? - causes the rally to stall and often pull back. But here's the thing: it often pulls back to the prior HIGH not the prior LOW, and that high is often now support. What usually follows is a zig zag pattern with the market rallying above its last relative high then selling off to form a low just above that high, until something happens that causes the rally to stall for good, forming a high that matches or slightly exceeds the last relative high, then a sell-off, then an abortive attempt to regain the old high, then the process reverses.
Of course, no market follows this script exactly, but it's astonishing how often it does, and why awareness of this tendency does not make it disappear (as people try to game what seems an established pattern, thereby destroying it).
The reason I believe that this pattern will continue is because the things that drive buying and selling behavior - fear and greed - have not changed and never will. As long as human beings make markets, markets will reflect mass psychology. This is something very few economists and precious few market commentators want to admit. That something as important as how trillions of dollars are invested at any point in time could come down to squiggles on a chart or a gut feeling held by millions of people as their regret at having sold too early or bought too late becomes overwhelming is something that we have a lot of trouble accepting. But if I ever hear that a market declined on fears of inflation or rose on an improved outlook from Apple, I always wonder why we accept this nonsense, as though
a.) there is a single reason why markets made of so many participants trading different time horizons for different objectives do anything; and
b.) this information so confidently reported after the closing bell was not reported (and acted upon) at the open.
The market, we are told by talking heads, will often panic today at information it shrugged off yesterday, the day prior, and the day before that. Why? If the efficient market hypothesis were true and markets reacted instantaneously and more or less perfectly to knew information, what you would see is a straight line between news or data releases, then immediate jumps to new price levels as information is released, then more boring flat line. People don't trade news, they trade how others trade the news, which is a constantly rippling feedback loop as participants become observers then participants again, changing the thing they are studying as the thing they are studying elicits certain emotions and behaviors in them.
All of this sounds very deep and theoretical perhaps, but for me it comes down to price and volume. The chart tells a story of buyers and sellers in a constant tug of war, each jockeying for position. Rallies, trading ranges, and sell-offs are caused by the same human quirks that cause traffic jams and the accordion-like effect we have all been subject to as we are forced to accelerate then brake, accelerate then brake, with no "fundamental" (externally valid) reason such as an accident or construction that can come close to explaining these wild oscillations. The only explanation can be found in our brains, in the tension between wanting to get somewhere soon (greed) versus the desire not to get into an accident (fear). But we are not alone, and must contend with how not just the driver in front of us, whom we have never met and don't need to to be part of an intricate, elaborate feedback loop, is also reacting. From these very simple inputs some surprisingly complex patterns, indeed all traffic and market patterns, emerge.