"Next open" always the best

Whatever strategy I run, it seems that “next open” is always the best, which must mean that the stocks that you are going to sell that day are probably going to fall until close, and that the stocks that you are buying will keep on rising until close. And in most strategies, it’s 2-5% better to get in at the open instead of using the closing price.

I have heard that in small- and micro-cap strategies, getting the open is hard, but is anyone of you using a strategy in the opening hours that can take advantage of just finishing the whole trade in the opening minutes?

Or is there any other good strategy for getting good fills besides sitting in front of the screen all day or using TWAP orders?

Not a VWAP order I think for some reason. I always use TWAP orders instead.

Yes, your are right I meant TWAP - order.

“next open” might be better for a different reason: it’s the closest price to the previous close, which is what your ranking is based on. If your buy and sell prices are very close to the prices that your ranking system calculations are based on your returns will probably be higher than if they’re somewhat farther away.

Try this. Base all your buy and sell and hedging and formula weight rules on RankPrev(2) or RankPosPrev(2) instead of Rank or RankPos.

Then try running those on next open and next close. If you’re still getting much better returns using “next open,” then you’re right and I’m wrong. If your returns are almost the same between “next open” and “next close,” then my explanation is probably the right one. If I’m right, then getting good fills isn’t the issue.

The gap for my strategy is only 0.83%.

I did not think Whycliffes gave a reason for his observations about price trends during the day that he could be wrong about. Did he?

Anyway, I just like to buy equities when the prices are lower without being so concerned about why I can get them at a lower price.

If the price is going to be higher at the close for whatever reason then a VWAP order for a buy might not be the best choice as most of the volume is near the close (and therefore most of your trades) for a VWAP order. What more do I need to know?

How could it be more complex than that even if I wanted it to be?

Basically, Whycliffes’ theory is that prices of highly ranked stocks (ones you want to buy) go up during the day and/or prices of stocks that are not quite so highly ranked (ones you want to sell) go down during the day.

This implies that ranking systems are so amazing that they can predict the intraday movements of stocks, not just the movement of stocks over the next few weeks.

I’m suggesting an alternative explanation, but I could be totally wrong about it. That’s all I was trying to say.

I think he just said the ones he wanted to buy tended to increase in price during the day and the ones that he wants to sell declined in price.

But I would not have objected to any theory by him that would suggest P123 is helping him know which stocks will go up in price. I just did hear (see) him say that.

I am surprised to see that you took the opposite view on that. Me personally, I think P123 helps me pick stocks that will be increasing in price over the holding period (or when a signal is generated) and that could include the first day for some ports.

Whychliffe’s observation did not surprise me one bit: my view alone, I guess.



I think some systems have excess returns realized closer to the timing of the signals, while others have the opposite.

Many papers have tested the returns of strategies implemented at different delays to prevent trading systems from being too sensitive to the time of implementation.

This sensitivity can limit the capacity and profitability of the strategy in real-world situations.

My system is not that sensitive to trading time, but it seems that his system is the opposite.

Thank you, Yuval, but even if I try using “rank prev” won’t the conclusion or the findings be the same?

When using the opening price and the simulation gives far better results, it must mean that the stocks leaving the portfolio keep falling through the day, and the buy stocks keep rising until the closing?

I think we’re both wrong about this. Even when you run a simulation with absolute nonsense rules, rules that make no sense and that end up with negative returns, the results with open are better than the results with average and those are better than the results with close.

Here’s my guess as to the reason. The stock market tends to go up. Every simulation has an end date, and the results at the end date are always those of the day’s close. So by using open prices at the beginning of your simulation, you’ll be getting one extra day’s return than by using close prices.

In other words, the fact that “‘next open’ always the best,” as you put it, reflects the length of the simulation, not what stocks are being bought or sold at whatever price.

If you run a simulation that sells all stocks on a certain date (use “or asofdate=20230811,” for example–just make sure that the date you use is a Monday), then the results aren’t nearly as consistent.

It’s also worthwhile trying to change the starting date and see if that makes a difference. I’m sure that some starting dates see prices falling during the day, which would likely reverse the effect.


Interesting, and you are probably right. But let’s say you use the close instead of the open; won’t you still get the same day of “extra” returns since you have all the positions you are going to close through the day until the close?

You will have the same portfolio at the end of the day, but you will drag the positions you are going to sell through the day, and postpone the stocks you are going to buy until the end of the day. So, since the stock market “tends to go up”, this should also be applicable to the positions you are going to close that day…

The difference is, I believe, due to the holdings at the very end of the sim, which are all held a little bit longer if you use open than if you use close. I think the effect will go away if you use or AsOfDate = 20230811 at the end of all your sell rules. Try different end dates and starting dates and see if that makes a difference. Just make sure that the AsOfDate you use is a Monday. When I use different starting dates and ending dates with AsOfDate then I don’t see any consistent pattern. The reason is that if you use the AsOfDate sell rule you will get a selling price of the open or close (whatever you specify) rather than the close (which is what you get if you don’t specify a sale).

In case that wasn’t expressed clearly, a normal simulation with no final sell date will show at the very end the closing prices of the stocks that are still held and the return will be calculated based on those closing prices. So if you buy your stocks at the open, all your held stocks will have an extra day’s return. You’re right that it shouldn’t affect the stocks that are both bought and sold, but the held stocks are what makes the difference.


How much can this account for? You are just overthinking this I believe. What you are saying as far as the cause is plausible but step back and accept whatever price action you see (forget trying to find the cause).

So the average daily return for the SP500 is 0.0417% Code for this below.

If you do a 20 year backtest this addition return gets diluted by 20 years for calculating the CAGR. I.e., 0.0417%/20 = .0021%

On average with a random start date for a sim with 20 year backtest = 0.0021% difference

Seriously? Even duckruck is getting a bit more than that.

So I would suggest you email duckruck and kind of get a consensus with him. P123 sims can give higher returns over the holding period, and theoretically at least, that can start with the morning of the buy date. That is why we are all here at P123 at isn’t it (the excess returns)? i hope it it not too surprising that this excess return is showing up in some of our sims.

BTW, you are an evangelist for those excess returns, correct? :thinking:



// Given average annual return and number of trading days
average_annual_return = 0.105 # 10.5%
number_of_trading_days = 252

// Calculate average daily return
average_daily_return = average_annual_return / number_of_trading_days

Just to show visually the difference any COMPLETE theory would need to account for at times (not just Yuval’s or someone else’s sim but should explain all sims) (Open first then close):

Jim -

Good points! What is the difference in returns between those two sims if you just look at the current holdings? (Go to the holdings tab and look at the return% column.) Also, what’s the difference in the year-by-year returns on the “Statistics” “Performance” tab?

I haven’t seen any differences nearly as dramatic, so this might help.


We can just look at Monday returns, right? And what would make Mondays so special? Maybe it’s that the prior weekend still has news events but no way for the market to respond.

If that’s right, then the initial market response is down w/ a return later in the day.

This can’t be the complete answer since it would imply a consistent trading edge i.e. long the Monday open. Does anyone want to make a sim?


I think Friday is specially. Here are my ports. Friday has always been special for me.

Have I mention I want to rebalance my machine learning ports on Friday when I can?

This is consistent with the published 'Day of the week effect"

With High\Low:


With Next Open:


With Next Close:


Jim, Do you use Friday open or close?