top of page
Search
  • Writer's pictureIsmael Basit

#2 Trading Algorithm: Technical Match Research

Updated: Sep 23, 2020

Welcome back to our AlgoTrading project, as you might as well read in the first post we started quite easily, but now it's time to get the real work done!

In this post titled "Match Reasearch" what we'll explain you is how to find similar trends, in the past, as the current one to evaluate, later on how (most likely) the trend will proceed.

Also in this case we will need to take a measure of time for our model to work efficiently, let's take it easy by now and let's take days and weeks, basically what we need to find is every period of let's say 3 week in the range of time we decide (eg. 2 yrs) similar to the title's last 3 weeks.

The first thing we can do is to find the first sequence of weeks that match, and in order for this explaination to be easier we will only work on this by now but the same work will have to be done to find all the other Matches.

The fist thing we have to do is to find a week trend like the corrent one, for example if the current is PPN (positive positive and negative) we will need to find a Match of three week in the same order (PPN); It can be easily done considering the weeks as Obj like in the first post, so once we find a P week (It'd have Binary value 1) the upcoming 2 weeks, which we can find by looking at the week with the position number of +1 and +2 must be P and N so that we can state, or eventually a computer that we MIGHT have found a Matching Sequence.

Now, as we know very well this isn't enough, we will analyse our roughly Matching Sequence to make sure it is what we really need, and we are going to do this by investigating inside those weeks, by looking a their days, we will have now 15 days to analyse and compare and here's how.

Let's say that since the Sequence we found and the current one the title increased of an x amount, but still we find both's trends very similar, how can we, mathematically, kind of ignore this factor? Simple we use make the difference of each day (for exampple day 1 of sequence 1 and day 1 of current sequence) once we do this for a week for example we can insert this differencies in a table and run the standard deviation function, this will tell us exactly how consistent the dataset is and consequently how accurate is that week 1 with ours. The first thing we need to make sure then is that the Sd (Standard deviation) is not to high otherwise it will mean it is inconsistent and we'd have to discard the Sequence.

We'd need then to proceed in this way also with the other two weeks and check the resulting standard deviations with the limit value we choose.

The Sequencies that will Match better will be the ones with the lowest sum of all three standard deviations and, in case of a draw the best will be the one with the lowest last Sd.

After that, the easiest way to predict the upcoming trend, yet not the most effective can be to calculate the mean increases or decreases of the title during the week that follows our best Sequence Matches and evaluate the best way of trading from them.

It is clear that our model of AlgoTrading works better with the most datas it has, for example, after a while, a suggestion we'd make is to store-in a library for every similar trend's sequences already so that it'll be faster and cheaper to find a Match since it won't need to go through the whole title's history.

It is clear that after a while the computer will do the opposite work, which means check if the current sequence match one of the list in order to save even more time.

We know this is a very big step in terms of difficulty since the last post but is always necessary to move forward, especially if risk to loose money!!

See you next post, hope you enjoyed, if you have any question, correction don't esitate to contact us!!

14 views0 comments
Post: Blog2_Post
bottom of page