Hi,recently, I read a book "Trading system analysis" by Robert Barnes.
In which there is a model generating synthetic market data,its name is (Simple) price vector model.
I am very interested in it,but I couldn't get the exactly steps to perform it,for there is only simple description about them in the book,no related fomulars and stepbystep examples.
Could anyone give me some further information about it in details?
much appreciation!
Any help about the price vector model,please?
Attached is a random data generator in an Excel file  just copy the formulae down as many rows as you want then copy to a regular ASCII file to work with. I presume this is what you are asking?
 Attachments

 Random Data Generator 95.xls
 Simple random data generator in Excel 95 format.
 (30 KiB) Downloaded 722 times
Thank you for your kindness,Roscoe,actually,I'v got another random data generator,but the pure random data can't show the characteristic of market,so I wanted to generate synthetic data from real data in some way,and that's the purpose of the price vector model.maybe it's my fault not to describ the way they are done.
Since the book doesn't say the exactly steps,I can only describe it in a brief.
the following is how the price vector model works:
1.get a series of real data,identify and catalog the price vector as bull(up) and bear(down),finding how many there are of each (up and down separately) and graphing them separately by numbers of segments or price changes fro each vector or move.
2.find out how many vectors are there,and how many cells there should be for each piece or segment in these vector
3.then start randomly with an upvector or downvector,determine vector segment length from the vector segment distribution graph,and create prices for each segment of the vector.
but I feel puzzle that how to identify and catalog vectors?that's,how to determine the length ?
Since the book doesn't say the exactly steps,I can only describe it in a brief.
the following is how the price vector model works:
1.get a series of real data,identify and catalog the price vector as bull(up) and bear(down),finding how many there are of each (up and down separately) and graphing them separately by numbers of segments or price changes fro each vector or move.
2.find out how many vectors are there,and how many cells there should be for each piece or segment in these vector
3.then start randomly with an upvector or downvector,determine vector segment length from the vector segment distribution graph,and create prices for each segment of the vector.
but I feel puzzle that how to identify and catalog vectors?that's,how to determine the length ?
There is an answer which is so obvious that I surely didn't understand the question
Let's take a simple sequence of numbers:Then draw a mark each time there is a "trend" change:In this example you endup with four "segments":
FWIW: here's some code that just implements the above:I'm sure you can translate this any way you fancy
later edit
If you have Java installed, which you can get otherwise from here you can compile and run the code as:
Let's take a simple sequence of numbers:
Code: Select all
20, 23, 28, 25, 26, 29, 27, 23, 21, 20
Code: Select all
20, 23, 28, 25, 26, 29, 27, 23, 21, 20
^^^
 starts at 20 and ends at 28, length: 3, nature: up
 starts at 28 and ends at 25, length: 2, nature: down
 starts at 25 and ends at 29, length: 3, nature: up
 starts at 29 and ends at 20, length: 5, nature: down
FWIW: here's some code that just implements the above:
Code: Select all
import java.util.ArrayList;
import java.util.List;
public class Sequence {
int segStart ;
int segEnd ;
class Segment {
float[] values ;
int start ;
boolean up ;
Segment(float[] series) {
values = new float[1 + segEnd  segStart] ;
System.arraycopy(series, segStart, values, 0, values.length) ;
start = segStart ;
up = values[values.length 1] >= values[0] ;
}
public String
toString() {
return " starting at " + start
+ " of length " + values.length
+ " is " + (up ? "up" : "down")
;
}
}
Segment[]
calcSegments(
float[] series) {
List segments = new ArrayList() ;
segEnd = segStart = 0 ;
float prev = series[segStart] ;
float curr = 0 ;
for (int i = 1, length = series.length ; i < length ; ++i) {
curr = series[i] ;
if ( (curr >= prev) && (series[segEnd] >= series[segStart])
 (curr <= prev) && (series[segEnd] <= series[segStart])) {
segEnd = i ;
} else {
segments.add(new Segment(series)) ; // start new segment
segStart = segEnd = i ; // segments share
segStart ; // last value
}
prev = curr ;
}
segments.add(new Segment(series)) ;
return (Segment[]) segments.toArray(new Segment[0]) ;
}
void run(float[] series) {
Segment[] segments = calcSegments(series) ;
for (int i = 0, length = segments.length ; i < length ; ++i ) {
Segment segment = segments[i] ;
System.out.println("segment #" + i + segment) ;
}
}
public static void main(String[] args) {
float[] sample = { 20, 23, 28, 25, 26, 29, 27, 23, 21, 20 } ;
new Sequence().run(sample) ;
}
/*
* segment #0 starting at 0 of length 3 is up
* segment #1 starting at 2 of length 2 is down
* segment #2 starting at 3 of length 3 is up
* segment #3 starting at 5 of length 5 is down
*/
}
later edit
If you have Java installed, which you can get otherwise from here you can compile and run the code as:
Code: Select all
javac Sequence.java
java cp . Sequence
Last edited by verec on Sun Sep 12, 2004 7:37 pm, edited 1 time in total.