Is the stock market really random? Can we see it as a probabilistic system where the prices rise and fall with certain possibilities in certain times? Should we really trust numbers? (This is important for quants :)
I tried (again) Apple and decided to buy if a random number between 0 and 1 is larger than the probability of price rise within the last 5 days. Note that if we assume uniform distribution, that corresponds to the fact that we buy with exactly the same probability for the price to rise the next day. I used batch transform to make the code more readable. (Thanks to Thomas for the advice)
The result turned out to be pretty nice. I tweaked the window length to 10, and it didn't change much. Seems that the market can at least be roughly treated as a probabilistic model.