step by step analysis needed

The methodology and techniques of cycles analysis

Re: step by step analysis needed

Postby RayTomes » 15 Nov 2012, 08:07

Hi Rares

Before proceeding, I suggest editing your cats.ini file which says:
so that the end date is in the future a bit, say the end of the year 20121231.23 because otherwise we cannot make forecasts.

Generally I load the speclog.csv file into a spreadsheet and sort on the 5th column so that the most significant cycles (lowest Bartels) come to the top. You can ignore the first two lines as they refer to less than two cycles and therefore have 0 set because no Bartels exists.

There are a large number of cycles found, and many are less than p<0.05, but many of these will be spurious cycles. I would start with the ones with p<0.01 or p<0.02, but perhaps leave out the 2.11572 period because very near to period 2 is in danger of being aliases. See for info about that. Generally avoid periods less than 2.5 and be wary of less than 3. As an option you might also include some longer periods with p<0.05 or so. These are just rough guides. You don't want too many cycles to start with. They have to earn their keep. But leave that aside for now ...

For the purposes of demonstrating how to make a projection using cycles analysis, let us just 4 of the longer cycles with periods 305.63522, 272.4201, 130.31892, 124.08486 and remember these periods are in units of the time step of 1 hour.

clear the stack and put pairs of sine/cosine waves with these periods on the stack...
Z 305.64 Usc 272.42 Usc 130.32 Usc 124.085 Usc
Note that Usc is a macro that will make two stack entries with period of the number loaded immediately prior, one a sine and one a cosine. We now have 8 entries on the stack which can be checked by doing ?
Next, load your data series and do a regression equation from the 8 waves
F60 R8
and you will get some statistics listed on the screen. It will also replace the original series by the equation for making estimates from the sines and cosine waves. You can use that equation on the 8 waves to make estimates, which will continue into the future:
Now we want to see the original series and the estimates, but realize that we are only estimating some medium frequency part and not the overall movement of the prices. (The trading is really with the fast cycles like 9.90635, 5.13169, 9.74359, 17.25275 hours. But this is to demonstrate what happens.)
F60 g2
this shows the estimates in red and the original series in black. Quite clearly it doesn't follow the trend on the graph. But many of the peaks and troughs (not all by any means) do correspond. You have a projection also to the date that you set in the cats.ini file.

Note that the 4 cycles used are interacting and sometimes making wider swings and sometimes cancelling each other out. Obviously if you want to trade these cycles, then you would be best to use the parts where the swings are wider.

This is just a first primer. Try it out and understand what CATS is doing at each step. Try it with more and with less cycles. Include some of the longer ones and some of the shorter ones. If you want to see what is happening with the shorter ones, you will need to view just a part of the data. CATS is not fancy software when it comes to this. See the D command.

A note about trading. It is a risky business and I do not recommend it to anyone. If you must do it, do paper trading for some time first to see if your method is any good. Then only use funds that you can afford to lose. And don't cry when you go down, don't lose your cool, but if you have a good system it will go up 55% or 60% of the time. Never 100%.

Have fun
User avatar
Posts: 128
Joined: 02 Aug 2010, 23:24
Location: Auckland, New Zealand

Re: step by step analysis needed

Postby RayTomes » 15 Nov 2012, 23:46

Yes they are weekends. When T (trading day) or missing data occurs in CATS it leaves spaces in the data. The default for such spaces is to interpolate with a line as you see here. There are other options for missing data, but in this case it is the best one.

The filling in like this of missing periods is essential so that cycles timing is correct. This is based on the idea that cycles continue to run even when markets are closed. Not everyone agrees that this is so, but I think that the evidence is good that it is the best assumption.

These will not greatly affect your results when doing cycles analysis. However shorter cycles will be slightly diminished in amplitude because of the missing periods. Longer cycles (more than a week or so) will not because they will still get to where they need to go.
User avatar
Posts: 128
Joined: 02 Aug 2010, 23:24
Location: Auckland, New Zealand

Re: step by step analysis needed

Postby RayTomes » 16 Nov 2012, 23:52

I just picked those cycles to demonstrate how to fit cycles, nothing more. I wanted them to be long enough cycles to see on your chart (the ~3 day cycles would be too hard to see on full chart).

Yes, picking cycles is the art. And trial and error. After a while you get a feel for it. General principles:

1. Start with only the most significant cycles.

2. Start with the longer cycles. Problem is that this may contradict 1 as cycles with few full cycles present will seldom be significant even if real. So long cycles that are not significant can be included to get the general shape of the past trend as long as you understand that they probably will fail in future.

3. Don't add too many cycles. Hurst used only about one cycle for each ratio of 2 in the period.

4. The product Hurst Trader follows Hurst's method accurately. Then Sentient Trader was made to incorporate additional methodologies. Some of these were based on my Harmonics Theory recognition of additional ratios than 2 and 3 as in Hurst, and some on analysis done with CATS to find the intra-day cycles. Have a look at the forum
These programs cost money, but are valuable to someone who wants to trade as there are so many more considerations to trading than just making a prediction. CATS is more a research tool.

5. CATS outputs various files from regression, spectral analysis etc and so on that can be looked at with external tools. You can save your created prediction file and use that in some other program if you make a simple conversion program as CATS file is very easy to read. You can make external programs that can be called by CATS while CATS is active, but that is a little more complicated.
User avatar
Posts: 128
Joined: 02 Aug 2010, 23:24
Location: Auckland, New Zealand

Re: step by step analysis needed

Postby RayTomes » 18 Nov 2012, 00:01

After you have created the summation you can save it as a new series with say
L N =F20
where L means make a copy of the line (to leave the original still there)
N asks to be allowed to enter the name of the series, to which you can reply with short name and long name etc, e.g.
sum, sum of cycles periods .....
and F20 says to store as cats file number 20. This will include the short name in the filename so that you will now have a file called 20-sum.cats with the resulting data. You can open that file and copy the values into a spread sheet with copy and past.
You will see that in the cats file the long name has been saved as a memory aid to what it is.

Note that CATS continually saves all the commands that you type in the file catslog.txt, adding to it in each subsequent session. You can put comments in the log file too with the &C command such as :
&C"testing 10 cycle projection"
and these serve as reminders when you want to remember what you did to create some graphs and files. If you find yourself using the same commands often, then make them into a macro with:
Omacroname .... common commands .... [note macroname is what you want to call this macro]
and then later you can get that list of commands by putting just Umacroname

Have fun!
User avatar
Posts: 128
Joined: 02 Aug 2010, 23:24
Location: Auckland, New Zealand

Re: step by step analysis needed

Postby RayTomes » 18 Nov 2012, 00:29

I would like to introduce you to a variation on trying to fit cycles to prices. We are not really interested in prices. We are really interested in changes in prices.If we look for and can predict changes in prices then this is much more useful. We want to know whether something is going up or down, and how much. So instead of starting with F60 each time, we start with:
F60 L :1 -
which says take F60, make a copy of it and slide along one time period and subtract one from the other. The new series is then one hour changes in price. If we now do a cycles analysis on this, we get some similar cycles showing and some different ones. But we get a lot more significant cycles appearing. These are all at p<0.01 in the speclog.csv file after loading to spreadsheet and sorting on 5th column.

Code: Select all
no.cycles   period    ideal peak date/time   amplitude   Bartels p

409.09   7.28935   735062.343516302   0.071877   0.00045038
717.89   4.15384   735062.282010728   0.06648   0.00071914
844.73   3.53012   735062.308527258   0.063388   0.00169423
285.34   10.45069   735062.533645972   0.057374   0.00264765
368.01   8.10304   735062.486971071   0.059451   0.002751
471.9   6.31914   735062.302530521   0.060914   0.00328236
648.84   4.59589   735062.247366928   0.060983   0.00389647
481.59   6.19199   735062.346023908   0.055605   0.00396299
581.59   5.12732   735062.346784308   0.06002   0.00442063
70.33   42.40011   735062.94586214   0.055357   0.00753684
900.21   3.31256   735062.343930354   0.0594   0.0080895
663.25   4.49604   735062.352718958   0.05604   0.0081972
133.55   22.32871   735063.053740877   0.056074   0.00863222
181.7   16.41167   735062.361217537   0.053414   0.00881774
430.31   6.92989   735062.274810462   0.053119   0.00883255
363.48   8.20403   735062.3812359   0.050555   0.00924746
756.46   3.94205   735062.292007808   0.051684   0.00939222
301.07   9.90467   735062.383523081   0.052658   0.00960733
666.68   4.47291   735062.22257435   0.059355   0.00974803
48.37   61.64978   735063.351779887   0.054269   0.00988011

Although the phase and amplitude of cycles are given by the spectral analysis, I recommend establishing phase and timing by the regression equation as shown previously, because statistically this copes better when some cycles are very close in period.

The 3rd column with date and time of ideal peak is in days since the beginning of time (joke) but can be converted to year and decimal by dividing by 365.2425 e.g. the 7.289 day cycle has peak at 735062.343516302/365.2425 = year 2012.53234

You can do a cycles projection the same way with any selection of these cycles (or the lot) and see what happens. Once you get the result, remember that it is hour by hour predicted changes. You can turn back into something that looks like price by using the A (accumulate) command to add them successively together. You will probably need to add a constant to get it to line up with the original price data.

Hope that this gives some fresh ideas.
Last edited by RayTomes on 18 Nov 2012, 00:33, edited 2 times in total.
User avatar
Posts: 128
Joined: 02 Aug 2010, 23:24
Location: Auckland, New Zealand


Return to Methods

Who is online

Users browsing this forum: No registered users and 2 guests