top of page
Search
  • Writer's pictureIsmael Basit

#1 Trading Algorithm: Finding Periodicity

Updated: Sep 23, 2020

So, this is our first post on how to model and create an efficient AlgoTrading tool, let's get started easily!

First of all we need to get in the perspective that the operations we are going to make are gonna be binary operations, simply that means we have to see whether the trend is going to be positive or negative, by now we do not need to analise where the stock's or index' value is leading exactly, evaluating particular stages and stuff, let's tatke it easy by now!

What we can do first is to pick a range of time to analise, let's say 2 years, second we have to decide how to split those 2 years, let's go easily and choose 1 week, so we have about one-hundred weeks in our set of data, which is even possible to be studied without a computer and it'd take a blink of an eye to be read by a program.

So, we have this 100 weeks, what are we going to do, simply we are going to consider each week as an obj that has three attributes:

First: Binary Value, wich tells us whether or not the value increased, if it did then it'd be 1 otherwise 0.

Second: Position Integer, this will be the week's number since the two years we are considering, starting from zero.

Third: Sequence Integer, this, starting from zero will tell us since how many weeks the stock has had the Trend of the Binary Value.

From our list of week we have to extrapolate a few values, the PA average of positive (that means the number of positive weeks divided by 100; next we need to have the average of the APSL positive trend sequencies' length, this can be done summing up all the Binary:1 week's value of Sequence Int that are followed by a Binary:0 and divide the sum by the count of the elements we took; the final value we have to get is the PAN positive-average after N week, note that n is the number of weeks that the trend is currently on, so, basically, the Sequence Int of the current week.

!!! IT IS CLEAR THAT IF THE TITLE HAD A NEGATIVE LAST WEEK YOU NEED TO INVERT THIS CALCULATIONS BY TAKING THE NEGATIVE WEEKS UNDER CONSIDERATION!!!

Many of you may now be asking themselves, what are we going to do with these numbers, simple, first you need to divide the Sequence Int by APSL (average positive sequence Lenght) and as it is most likely to be a decimal number if its decimal part is between .5 and .99 it means the positive sequence is mostl likely to finish, the value you'll have will be named PeVN periodicity value now, or after n, as you prefer.

You can now multiply the number of PA (positive average) with PAN and PeVN keeping in mind the note on PeVN, the last step is to divide this number by the decimal part of PeVN, so, the title, index or forex with the highest value in your list is the most likely to have a positive next week!

11 views0 comments
Post: Blog2_Post
bottom of page