Generating profit by leveraging fluctuations I was writing some code akin to a sound limiter when it occurred to me that if you could find something fluctuating in price between two extremes (what and when those extremes would be isn't relevant I think, just the fact that between those extremes there exists a space where the &quot;signal&quot; would always return to) you could theoretically leverage that in a market setting.
If such fluctuations had sine-wave like properties you could write an algorithm that &quot;buys&quot; below zero and &quot;sells&quot; above zero and generate a profit this way. (I'm using quotes because I really don't mean to exclusively ask about financial markets or stocks, just any exchange that fits the description)
This raises some possibilities:

I'm the programmers answer to Einstein, I should have kept this to
myself and could have made billions.
The type of predictable fluctuations that are needed do not occur in reality ever. This is feels counter
intuitive to me, stocks go up and down, economies wax and wane?
This actually happens but the fact that it does
&quot;closes the gap&quot; so to speak, i.e. it leads to an equilibrium
because even the tiniest fluctuations are &quot;used up&quot; like this. If
so, is this a principle that has a name I could read up on?
This is, when talking about physical goods, entirely impractical because it
implies storage. Similar constraints exist for other kinds of
markets.
This is something very mundane, I'm just thinking about it
in the wrong way.
Something else?

What's going on here?
I've tried finding information on this subject but I'm having a hard time formulating a query. To me, this has all the hallmarks of something that would appear either as a game in game theory or as a problem category in computer science, however it seems to me that it is essentially an economics question, that's why I'm asking it here.
I've also tried asking on another site with an ill conceived practical example, but that never got me past 1, or at least the discussion never really went beyond the practical example.
Generally, it's a combination of 2 and 3.
You can't predict that a stock will go up and down in cycles. Stock prices move randomly. Let's say you're looking at one stock, and it goes down so your algorithm buys some and waits for it to go back up. What happens if it never goes back up higher than it started as? Then you lost money.
Even worse: Even if it does go back to where it started with, you still lost money. Stocks have an overall upward trend, so you have to make more than a certain amount of money, or otherwise you would've been better off by just buying random stocks!
Why do stock prices move randomly? According to the &quot;Efficient Market Hypothesis&quot;, stocks move randomly because all non-random information is already being exploited by other people (point 3) until it stops being profitable to do so. Thousands of people might get a couple of cents each from the fluctuations.
When something has a regular fluctuation - like ice-cream prices perhaps - there's a reason. Maybe (hypothetically, if ice-cream prices fluctuated a lot) you could make money by buying ice-cream in winter and selling it in summer. You'd have to have a big refrigerated warehouse, and that would be a legitimate way to make money, it wouldn't just be a financial gain.