stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Prediction of turning points based on ZZ on fractal calc....
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3210
Page 4 of 14
Author:  SpiderX [ Thu Oct 31, 2013 1:13 am ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

Hi Kilian,

Are you using bits to implement your algorithm ? or just storing information in integers or long ?

For example:
1111 1111 1111 1111


you can store it directly as
long a = 1111 1111 1111 1111;

or the more efficient way:

int a = 0xFFFF

in this way calculation and manipulations could be must more efficient as less memory is required.

Operations maybe less straightforward in this manner, but it should be possible to implement functions to manipulate the bits as if it is an array of integers.


Cheers
Author:  Kilian19 [ Thu Oct 31, 2013 10:40 am ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

SpiderX wrote:Hi Kilian,

Are you using bits to implement your algorithm ? or just storing information in integers or long ?

For example:
1111 1111 1111 1111


you can store it directly as
long a = 1111 1111 1111 1111;

or the more efficient way:

int a = 0xFFFF

in this way calculation and manipulations could be must more efficient as less memory is required.

Operations maybe less straightforward in this manner, but it should be possible to implement functions to manipulate the bits as if it is an array of integers.


Cheers
Hello spider I have to admit that I am mostly working with ints strings and longs. :?
I thought about storing those 0 and 1 strings as integer number as well but the problem is that strings exist with multiple leading zero.

0011100
011100
11100

Those all can occur and we can't differentiate them by using simple integer values.

To my shame I also haven't written the code very object oriented .....

Code: Select all


private Map<Integer,Integer[]>  data = new HashMap<Integer,Integer[]>(); // BarDataSet
private Map<String,Long> set1 = new HashMap<String,Long>(10000000); // BarDNA
private HashSet<String> set2 = new HashSet<String>(400); 	// FractalDNA
private Map<String,Long> set3 = new HashMap<String,Long>(400); // Filtered BarDNA
private Multimap<String, Integer> set4 =  ArrayListMultimap.create();	// ZZLeg DNA


I am far away from efficient programming. I know I have heard a lecture once they went into everything small detail like saying that bit operators are cheaper than modulo etc... but since I am already happy when my code works without an error message, this is understandable. If the indicator starts to show good results I will rewrite the code. (Currently I face the problem that apparently I am using some Java 2d vector exploit and avira want's to block my program). If I turn my antivirus program off it works flawlessly and without an error or exception so I have no idea whats wrong....

I guess once this project has proven to work I will pass on the rules to some experienced programer who can write the code from scratch on.
Author:  Kilian19 [ Thu Oct 31, 2013 11:16 am ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

Eurusdd turned price moves into strings of 1's (up bar) and 0's (down bar). Then he extracted out "genes" of different length from that sequence of 1's and 0's. That might be every bar (bar 17 18 19 20), every other bar (14 16 18 20), every 3rd bar (11 14 17 20), etc.
Yes thats right.

Thats how I do it (can you see any major logical mistakes?):

externalCount bars recorded in datafiles.

Code: Select all

		private static int genBarDna(int startOffset,int endOffset){
		//A[c + a * b]
		int seqCount = 0;
		for(int i = STRINGLMIN; i<= STRINGLMAX; i++)	
		{
			int count = 0;
			gui.println(DATEFORMAT.format(new Date()) + " | Start Sequence length " + i);
			for(int c = 0+startOffset; c < externalCount - endOffset; c++)
			{
				// if the last bar lays in the future terminate 
				for(int a = 1; c+a*i < externalCount- endOffset; a++)
				{
					String result = "";
					for(int b = 0; b < i; b++) // b 
					{
						Integer[] temp = dna.get(c+a*b);
						result += temp[0];
					}
					// done;
					if(set1.containsKey(result))
					{
						set1.put(result, set1.get(result)+1);
					}
					else
					{
						set1.put(result,1L);
					}
					count++;
				}
			}
			gui.println(DATEFORMAT.format(new Date()) + " | Sequencing completed ("+i+") " + iFormat(count) + " Sequences generated");
			seqCount += count;
		}
		return seqCount;
	}
* I understand the "every bar" gene, but I really wonder how applicable the "every Nth bar" genes are to current price action. I guess he's trying to pattern-match against higher-TF patterns (if your base TF is M1, then the "every Nth bar" gene sorta gives you a sample from a N-minute TF), but I wouldn't expect them to match very exactly with the bar-by-bar patterns.
That is what I am wondering about as well. For me it didn't make sense to just randomly grab every 500th bar and compare them... That is actually the big question. No one knows why it works we just know that it does.
* I questioned the use of bars. We don't care about N-minute periods, we care about price movements. gg53 proposed using fractals instead of (or in addition to) bars, which makes a lot more sense to me. He looks at the sequence of fractals that make up a Zig-Zag leg. He's also looking at Range bars or Renko bars, which also makes more sense to me than time-based bars.
GG looks at the originally created Bar DNA and creates the Fractal DNA in almost the same way. He takes the Fractals of 1 completed ZZ Swing and creates all the subsuequences. Once that done he compares the sequences of both sets and if the BarDNA doesn't appear in the Fractal Dna he marks this entity as noise and throws it out. For me range bars make the most sense as we mark just up and down movement and on normal timeframes the algo doesn't differenciate between a doji pip and a 20 pip bar. This would be solved by using ranged bars. I don't really like renkos since an up and down bar have either x pips or 2*x pips. But they are not constant.
* I wouldn't have expected this data-mining and pattern-matching to have much (any?) predictive power. But gg53 and crodzilla are generating some VERY impressive signals at turning points, with two independent implementations. They're often / usually within one bar of the actual ZZ turning point. You could generate some very profitable trades from those signals. That proof-of-concept has kept people interested.
Crodzilla's results are partially brilliant and partially not so good. We have to see where the difference is.
Author:  scheinwerfer [ Thu Oct 31, 2013 12:25 pm ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

Kilian19 wrote:
I thought about storing those 0 and 1 strings as integer number as well but the problem is that strings exist with multiple leading zero.

0011100
011100
11100

Those all can occur and we can't differentiate them by using simple integer values.
At first I had the same fear of multiple zeroes, but I asked Squalou and he said it's not a problem. My testing results showed that it really is not a problem, int array can take multiple zeroes, even though they don't show up on the screen. Later there can be problems with leading zeroes, but one can work around it fairly easily. Ditch the strings, speed impovement will be enourmous!
Author:  Kilian19 [ Thu Oct 31, 2013 12:49 pm ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

scheinwerfer wrote: At first I had the same fear of multiple zeroes, but I asked Squalou and he said it's not a problem. My testing results showed that it really is not a problem, int array can take multiple zeroes, even though they don't show up on the screen. Later there can be problems with leading zeroes, but one can work around it fairly easily. Ditch the strings, speed impovement will be enourmous!
Can you please show me a simple example of what you mean?

How would you represent a fractal sequence of "00" in integer notation?
Author:  jcl [ Thu Oct 31, 2013 2:24 pm ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

If strings are not longer than 31 bits, start the string with a nonzero bit in the integer, f.i. the string 00001111 would be stored as 100001111 = 271, and the string 111 would be stored as 1111 = 15.

The autocorrelation horizon of a price curve is in the range of 2 to 5 bars, so strings longer than 5 bits would normally make no sense. However, I see anyway no rational background for the whole method, so the too long strings make no difference. Its interesting that such a method produces magical predictions, at least for one - please keep us informed about your results.

In my experience, it's normally the other way around - you implement trading methods that are theoretically great and find that they produce poor results. Well, you never stop learning.
Author:  SpiderX [ Thu Oct 31, 2013 4:26 pm ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

Hi Kilian,

There are two possible solutions:

1. You have to define everything properly with naming, i.e:
int oneBitString;
int twoBitString;
int threeBitString;

In that manner it would be clear how many bits there are.

2. Create a class with:
int bitString;
int numBits;

Then you can have class functions to manipulate bits and make your life easier.
Everything would be modular and sweet. :D
Author:  garyfritz [ Thu Oct 31, 2013 8:27 pm ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

Kilian is correct that 00011, 0011, 0011, and 11 are all distinctly different patterns, and simple integers wouldn't distinguish them. You need some way to determine how long the string is.

jcl's solution is simple and brilliant (of course :D).
Author:  Kruspe [ Thu Oct 31, 2013 11:12 pm ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

What´s new guys ? Kilian, I´m still not sure how the probability of a ZZ end is calculated. Could you please explain it more a little more ? Is there any rule or instruction how to do it ? Btw our development in this area will start the next week. I will share and discuss our results here, keep your fingers crossed ;)
Author:  scorpionx20 [ Sat Nov 02, 2013 12:56 pm ]
Post subject:  Re: Prediction of turning points based on ZZ on fractal calc

Making predictions using fractals? Is it possible?? :shock:
All times are UTC Page 4 of 14