# ChatGPT for trade strategy selection

All,

I have been a big advocate for Thompson sampling as a way to select a trading strategy. You no longer need to understand Thompson sampling or do any code. You will need to keep track of the success or failure of a strategy (perhaps in a spreadsheet). You could define a success as; “an average price below the open for a buy.” But here is what I mean. You can just ask ChatGPT this question before each trades:

It selected strategy ‘two’ for this morning. I would include the rest of the output but you can explore this yourself and get the code through ChatGPT.

I will copy and paste this in support of ‘use-case’ for this being potential useful to members:

“Optimality: Under certain conditions, Thompson sampling has been shown to be asymptotically optimal, meaning that in the long run, it performs nearly as well as the best possible strategy that knows the true success rates.”

So translated, you can do nearly as well (asymptotically) as if you know which strategy is best ahead of time. What more could you ask for? But you do not need to code or even understand Thompson Sampling. ChatGPT can do it for you now.

FWIW, ChatGPT has been pretty reliable on this question with no hallucinations. With code interpreter you can inspect the code or even copy and paste it each time and run in in your Jupyter notebook. So you can use this reliably with a little checking to be sure if you want.

Jim

Duckruck,

Thank you. A couple of quick takes. From the paper:

“….common in time series applications to introduce an embargo sample between the training and validation samples so that serial correlation across samples does not bias validation. For stronger serial correlation, longer embargoes are appropriate.”

Temporal ordering of the training and validation samples is not strictly necessary."

I am not sure that you are familiar with the idea of an embargo. Ideally one would use an embargo. In practical terms I have been using k-fold validation from Sklearn. It seems to be adequate but one should keep shuffle = False as you know: KFold(n_splits=5, shuffle=False).

That does not stop me from using an embargo at some point. It is not that hard to do.

Second it discusses Ridge Regression. FWIW Elastic Net regression has been performing better for me personally EVEN IF ELATIC NET REGRESSION DOES NOT REMOVE A FEATURE. And it gave different answers than Ridge Regression (with k-fold validation).

That surprised me. I think I found a reason but will not include it here out of brevity and because I may not have fully understood.

None of that about elastic net regression is any attempt to compare it to PCA regression or partial least squares regression. I do plan to explore those more and I have found those useful in the past. I have only played with PCA regression and partial least squares regression without k-fold validation making their performance uncertain (I’m probably not using the right number of components essentially).

I am sure I made some errors in my brief take but very interesting and I will explore it more when I get time. Thank you.

Best,

Jim