1
$\begingroup$

I have a time series of closing prices for a given stock. I would like to formulate possible future scenarios for the price.

My intention is not to use these "likely" scenarios to take any position. I just want to have 3 possible scenarios that are somehow likely to happen if history repeat itself. My goal is to use these scenarios in a sort of battleplan to prepare myself in terms of trade adjustments if these (or similar) scenarios are actually going to occur.

I want to try an historical based approach: given the recent price dynamics I want to find the most likely future patterns based on what happened in the past. For example, suppose that most of the time in the past after 3 days of down moves the price has then moved up. If we are now on the third day of down move, I could consider that an upmove tomorrow is the most likely scenario.

I have seen that machine learning should do something like this but I have very limited knowledge in this field. Is there any library/toolbox I can use to easily do what I want to do? I am familiar with R, MATLAB and C#/VB so I would prefer to work with these languages if possible.

Just to add clarity: as said, I want to formulate future scenarios so what I really need is not only the most likely future pattern but also other patterns in decreasing level of likelihood. In other words, I would like to have for example the 3 most likely price trajectories that could happen in the following n days. So the machine should extract these forecasts by learning from past price dynamics. Is it something doable? Thank you.

$\endgroup$
  • $\begingroup$ It's very easy: either it will move up, or down, or will stay roughly the same. See, no ML needed. $\endgroup$ – LazyCat May 14 '15 at 13:39
  • $\begingroup$ @LazyCat just came across this today. A great comment ironically living up to your name. $\endgroup$ – Attack68 Jun 12 '18 at 15:12
1
$\begingroup$

Machine learning is a very wide field. Most often it is used for classification or regression tasks when you have labelled data to train the model. For example you show thousands of labeled pictures with an apple and computer "learns" what set of features gives high probability that picture contains an apple (for example, round, red etc). Now in your case next day scenarios are your labels. First of all you need to label all your historical data with possible scenarios (break out day, failed breakout day, range day, volatile day, reversal day, boring day etc, whatever you use). Once you have labels you can choose whatever model you prefer (probably decision trees or random forest are best for this) and give it some features (last open/close, moving average, last day type etc) and train it (just look for some tutorial how to do that with for example R shouldn't be very hard). Sounds easy? Not so fast. "give it some features" is actually most crucial part. You must have some insights on how to predict next day and which features matters. If you just give closing price model will not learn anything because no one can do that. Features you provide MUST have some predictive power for that. That's why "no free lunch" theorem exists - you must know your domain if you want to train a machine. So from your own question "given the recent price dynamics" is crucial - you must be able to predict next day yourself so you can find some features for the model that have real predictive power so model can learn. Once you have labelled data and select features you should train model not on full historical data but only on part of it and use other part to validate how your model works. If model overfits or underfits - back to feature selection. Do that until you are satisfied with the results. Another approach could be market simulation. Trying to guess market microstructure and simulate possible outcomes. Something like this: https://intelligentjava.wordpress.com/2014/09/16/stock-market-simulation-with-cellular-automaton/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.