I don’t know how many of you have developed a European RS, but for some reason, the use of open vs. close doesn’t work the same way in Europe.
Can anyone confirm this?
I don’t know how many of you have developed a European RS, but for some reason, the use of open vs. close doesn’t work the same way in Europe.
Can anyone confirm this?
For me it works the same: next open is best, next close is worst.
I made a spreadsheet to compare sell and buy transactions - If you make a copy of the spreadsheet you can copy/past your own transactions in to it.
Thank you! I will test it!
Do I understand your findings correctly that the best idea is to close the sellers at the open, and buy the buys at the close?
In my sample data it looks like the best buy is on the previous close, best sell in next open (with a small margin to previous close).
When I click on Rebalance now for a live strategy, it says “Recommendations will be based on fundamental data as of 2023-08-26.”, that’s two days ago. In a simulation, do we simulate on fresh data from today, or two day old data (as in live strategies)?
Im getting some weird results!
Im trying to compare the same strategy, but buy close vs. buy open.
I downloaded the whole transaction history, which should be identical. But it isn’t. As early as line 28, the difference starts. Why?
TL;DR: I hate munging data a little less since ChatGPT came along. And do not let this fool you. I suck as programmer. I did not get inner and outer merge right. I called it “external merge” and did not have the right use, for example.
Here are the results for 20 years of data for the sim above. ChatGPT allowed me to upload the entire file:
Difference of open compared to close (buy then sell). I.e. buy open and sell open just as Yuval says above (for my model too); Or for buys the close price is higher than the open and for sells the close is lower than the open (on average over 20 years). We have the same result FOR A SIM RUN ON MONDAY:
So I do not know why the columns do not line up but I was pretty sure they would not. Maybe this is important and Yuval can tell us why if Whycliffes wants to know.
Above I mentioned an “external merge” the correct term would have been ‘outer merge’ and I really needed an inner merge. Above was not correct.
One needs to do an’ inner merge.’ ChatGPT walked me through that. And BTW, you can upload the full 20 years of transactions.
Code:
// Perform an inner merge on the ‘Date’ and ‘Symbol’ columns
merged_df = pd.merge(tran_df[[‘Date_open’, ‘Symbol_open’, ‘Open’, ‘Price_open’]], tran_df[[‘Date_close’, ‘Symbol_close’, ‘Close’, ‘Price_close’]],
left_on=[‘Date_open’, ‘Symbol_open’], right_on=[‘Date_close’, ‘Symbol_close’], how=‘inner’)
// Extract the buy and sell rows from the merged dataframe
merged_buy = merged_df[merged_df[‘Open’] == ‘BUY’]
merged_sell = merged_df[merged_df[‘Open’] == ‘SELL’]
// Reset the index
merged_buy = merged_buy.reset_index(drop=True)
merged_sell = merged_sell.reset_index(drop=True)
// Compute the percentage difference in buy prices and sell prices
buy_price_diff_merged = ((merged_buy[‘Price_close’] - merged_buy[‘Price_open’]) / merged_buy[‘Price_open’]) * 100
sell_price_diff_merged = ((merged_sell[‘Price_close’] - merged_sell[‘Price_open’]) / merged_sell[‘Price_open’]) * 100
buy_price_diff_merged.mean(), sell_price_diff_merged.mean()
Jim
BTW, same sim run on Friday (WeekDay = 6). People can draw their own inferences which may or may not apply to their models:
But maybe consistent with what Yuval has said, that as a general rule there is not much change in the prices during the day.
Jim
You will not get the exact same transactions if the account size differs over time, that’s why I made the spreadsheet, to only compare the transactions that matches.
I have used your spreadsheet on a model with 100 positions of the S&P 500. The model has over 21,000 transactions. Your sheet returns that it is best to buy at the next open and sell at the next close.
BUY transaction difference | ||
---|---|---|
0.07% | If positive, better to buy in the open | If negative, better to buy at Next Close |
SELL transaction difference | ||
0.04% | If negative, better to sell in the open | If Positive, better sell at next close |
Is that trades on Mondays or any day?
All trades on 1st trading day of the week.