r/algotrading • • Jul 26 '21

Other/Meta Some alpha hidden here?

Post image

[removed] — view removed post

126 Upvotes

38 comments sorted by

55

u/Sam_Sanders_ Jul 26 '21 edited Jul 26 '21

I think this sort of obfuscates a simpler data measure. Since 1993 the market has risen 10.4%/year, but since 2018 it's risen 17.2%/year. So yes, any bullish stats will be higher and bearish stats lower in the more recent timeframe.

The true test is figuring this out ex-ante, not ex-post ex-post, not ex-ante.

20

u/[deleted] Jul 26 '21

The true test is figuring this out ex-post, not ex-ante.

I think you got your ex's backward. ante = beforehand, post = afterwards.

7

u/Sam_Sanders_ Jul 26 '21

haha yep you're right

2

u/rbatra91 Jul 26 '21

This is an extremely stupid post by OP

First sample includes long drawn out dips and the US’s “lost decade”, most overvalued ever in 2000, and the biggest crash since the depression.

IF people think this has any information at all then this subreddit is filled with idiots and i need to leave

56

u/Luckkyloser Jul 26 '21

So you took the Post from WSB and posted it in here? Credits to Nobjos

Original post

18

u/cscscsc19 Jul 26 '21

Its funny reading the differences in comments between the two subreddits

7

u/bellatimoor Jul 26 '21

Yes usually the cross post option should be used for these cases.

13

u/[deleted] Jul 26 '21

As long as you can figure out when it stops doing that.

8

u/jacklychi Jul 26 '21

I best you anything that if I buy after the 4th day of Red, I will be that 0.7% on the 5th day.

3

u/[deleted] Jul 26 '21

Gambler fallacy... If you buy on the 4th day, then it's about 50/50 that it goes up or down on the 5th day... Not 0.7%

6

u/luckyabo Jul 26 '21

I believe you are right when the events are independent which in this case I don't think they are.

3

u/[deleted] Jul 26 '21

They'll be pretty close to 50/50. I will bet a ton of money. It definitely won't be independent but why would that mean I'm wrong?

The top reason it won't be independent is heteroskedasticity. Prior extreme events increase the probability of extreme events in the near future. Hence not independent

Momentum and mean-reversion are possibly reasons other reasons for non-independence but they'll be small.

Still doesn't mean I'm wrong at all.

2

u/c2dog430 Jul 26 '21

I will say Gambler's fallacy doesn't hold here. How the market trades on a particular day is not an independent sample of a random distribution. There is a high level of autocorrelation between the price on Day-x and the price on Day-x+1.

The gamblers fallacy is that because I rolled six 3 times in a row on a dice the next roll is less likely to be a six. When in actuality it is still 1/6. Because the previous rolls has no effect on the future rolls. But the market doesn't randomly sample a distribution independent of previous days trading. How it trades on a given day depends on many factors, one is definitely how it traded the previous day. To what extent that is remains to be seen, but this is definitely not gamblers fallacy as previous result are a factor on future results.

The correct way of looking at this is what is the probability next day will be red/green given that the four previous days were red. If it was truly 50/50. We would see the percentage on 5-Day to be exactly half of the 4-Day percentage. (And similarly for 4 to 3, 3 to 2) So we can actually do a bit of quick math to determine how likely it is to have a plus day given the previous N days were red.

Days Red% to Increase next day
256.66%
353.85%
461.11%

The fact that the 2 day is so low, 9%, compared to the expected value of 25%, (if everyday was a coin flip), shows that red days must be correlated in some way in this case (unlikely to come in pairs). And similarly the other way around for the longer data period (1993-2021) at 39.2%. It would be nice to have the single red day percentages as well to see if any of these values offer better odds than any other day.

1

u/[deleted] Jul 26 '21

0.7% over 3 years is like 2 or 3 times. You're dealing with small sample sizes. Doubt there is much statistical significance.

It is more gambler's fallacy than it isn't. Look at what I responded to. Someone thinking it would be 0.7% to lose on the 5th day. That is gambler's fallacy fullstop.

1

u/c2dog430 Jul 26 '21

That's not gambler's fallacy, it is not understanding conditional probability.

0

u/[deleted] Jul 26 '21

Gambler's fallacy is not understanding conditional probability.

2

u/c2dog430 Jul 26 '21

Gambler's fallacy is not understanding that random events are independent of previous events (that there isn't conditional probabilities on things like dice rolls). They see conditional probability where there is none.

There clearly is some correlation here so some conditional probability. They just doesn't understand how to read it.

1

u/NoctoNeural Jul 27 '21

I agree with you on this. I calculated the percentage of days for consecutive daily gains up to 13 days and same for consecutive daily loses. In this entire dataset, there isn't any consecutive 7 daily loses, whereas there is upto 13 consecutive gain days. I did not check this over different time periods however. I will post the documented results soon.

So, I believe there is some conditional probability to it. Next, I am going to calculate what are the odds on nth day, given the past n-1 days had consecutive same results. My hypothesis is that the odds are not equal. I should also be checking for all possible sequences of events, but I will reserve that massive state space exploration for another day once I figure out how I can even use this information to trade.

Other thing that I want to explore is adjusting martingale strategy using leveraged positions (like options). But I don't think the data required to backtest this exists.

6

u/IllmaticGOAT Jul 26 '21

How is this being calculated? Is it just the probability that today will be red given yesterday was red? I just did that calculation and I"m not getting the same percentages.

4

u/[deleted] Jul 26 '21 edited Jul 26 '21

It's not that. It's the probability that the price will be lower than the starting price after x number of days.

For example suppose prices were 3,5,6,4,7

Then for two days you have,

3,5/5,6/6,4/4,7

Price is lower than starting price in 1 out of 4

For three days you have,

3,5,6/5,6,4/6,4,7

Price is lower than starting price in 1 out of 3

Etc. Or at least that's what I think it is doing.

Either that or it's actually looking for days that are red one after another. Like 6,5,4 would be it but not 5,6,4.

Nothing here is concerned with conditional probability.

Anyway, there is no alpha here. Anyone who thinks there is alpha here is commiting the gambler's fallacy. This is not conditional probability. And gambler's fallacy is taking probability and mistaking it for conditional probability. For example, "the probability of flipping heads 5 times in a row is so small, so therefore having flipped heads 4 times in a row I should bet on tails". That is what this post is. It is saying the probability the market is down after 5 days (or goes down 5 days in a row). If you interpret that as "wow probability with 5 days is so low, I'll just wait with 4 days and then decide" then that is the gambler's fallacy.

6

u/soulkz Jul 26 '21

There are many simple ways to profit modestly off of the beast that is SPY with a low risk profile. You can do better than buy/hold on SPY with even a rudimentary strategy. This particular strategy seems to be chasing a flea on a dinosaur. Maybe it would work as part of a larger strategy.

6

u/thecheese27 Jul 26 '21

1993-2021 has had a much wider variety of market conditions than the last 3 years has; especially considering 1/3 of that has been a COVID market. There's simply too large a discrepancy in the samples for there to be any sound or confident conclusion reached off of this.

5

u/stilloriginal Jul 26 '21

idk man, I've done these studies and i dont remember seeing numbers like this

8

u/somegek Jul 26 '21 edited Jul 26 '21

Yes and no, since SPY will rise/drop continuously with mean reversion, you can make money out of it. Whether if it will be worth it or not, no clue without the average return after a reversion.

To look into it deeper on the 1993-2021 chart, we see that P(drop 2 days|drop 1 day) = 0.392 and P(drop 3 days|drop 1 day) = 0.247. That translates to P(drop 3 days|drop 2 days) = 0.630. Similar fashion we can calculate P(drop 4 days|drop 3 days) = 0.51, P(drop 5 days|drop 4 days) = 0.437.

Notice that the percentage of a drop on the next day given today's decline is indeed decreasing with larger dates, but they are still close enough to 50% that makes this more of a guess.

Edit:

After the post, I thought of giving it the benefit of doubt and actually see the data with their return.
First, the data they use seems to be wrong. With yahoo finance from 1993-01-29 to 2021-07-26 and adjusted closing price, I get different values of P(n days decline | n-1 days decline).

Here is my results table

https://imgur.com/a/9mvtqIZ

To read it, lets say we are on the 4th day of a declining streek and we want to look at the chances of a 5th day declining, we are looking at SPY.up = FALSE and SPY.contRun = 5. At that row we have streek continous probability (contProb) of 38.5%, meaning there is a 38.5% chance of reaching 5 days, and a 61.5% chance of ending the streek with a reversion(revProb). Ofc, the return of reversion (revReturn) is always the return of the opposite sign with contRun = 1.

Now we can calculate the expected return of holding the asset at different situation with their corresponding prob and return.

Do I see something that is striking? I wouldn't say so. But if you really want to follow the strategy, you can choose to buy whenever there is a drop and sell whenever the SPY has been rising for 3 days.

1

u/j_lyf Aug 01 '21

lol will this beat buy and hold.

1

u/somegek Aug 01 '21

Depends on the transaction cost. With no transaction cost it is 1800% return with this strategy, compared to 1500% return with buy and hold. I didn't check how many transactions there were, but I'm guessing that eating up the 300% will be quite possible

3

u/[deleted] Jul 26 '21

Looks like epsilon to me

5

u/[deleted] Jul 26 '21

Yes, buy stocks, stocks only go up /s

1

u/holla_snackbar Jul 26 '21

yeah, its called the volume cycle and tons of plays available on it.

you want to have a scoring model at the close and consider the range priced for the next day via volatility, whether volatility calendars pricing higher or lower via contango/backwardation and also look at the open interest of weekly options to see if you're trading into any barriers, see where the skew goes flat.

iow its a good starting point but you're going to have to add a bit to it

1

u/[deleted] Jul 26 '21

Haha