Hello,
This is my SQL database engine :
http://www.h2database.com/html/frame.htmlWhich SQL code to make a quotes 5 mns time frame table from a 1 mn
time frame table ?
I have already did and populate a 1 mn time frame table.
CREATE TABLE QUOTES1MN
(
DATE TIMESTAMP,
OPEN DOUBLE,
HIGH DOUBLE,
LOW DOUBLE,
CLOSE DOUBLE,
VOLUME BIGINT
)
;
All the things I need to do to make my quotes 5 mns time frame table.
First ligne 5 mns, is about 5 lignes 1 mn.
Do it like that :
DATE : is DATE from minute 4.
OPEN : is OPEN from minute 0
HIGH : is the highest HIGH from minutes 0 to 4.
LOW : is the lowest LOW from minutes 0 to 4.
CLOSE : is CLOSE from minute 4
VOLUME : is sum VOLUME from minutes 0 to 4.
Second ligne 5 mns, is about next 5 lignes 1 mn.
Do it like that :
DATE : is DATE from minute 9.
OPEN : is OPEN from minute 5
HIGH : is the highest HIGH from minutes 5 to 9.
LOW : is the lowest LOW from minutes 5 to 9.
CLOSE : is CLOSE from minute 9
VOLUME : is sum VOLUME from minutes 0 to 4.
Third ligne 5 mns, is about next 5 lignes 1 mn.
Do it like that :
DATE : is DATE from minute 14.
OPEN : is OPEN from minute 10
HIGH : is the highest HIGH from minutes 10 to 14.
LOW : is the lowest LOW from minutes 10 to 14.
CLOSE : is CLOSE from minute 9
VOLUME : is sum VOLUME from minutes 10 to 14.
etc.
Datas from table QUOTES1MN.
DATE,OPEN,HIGH,LOW,CLOSE,V
OLUME
2007-01-02 12:00:00.0,"1,9715","1,971
5","1,9712
5","1,9712
5",-1
2007-01-02 12:01:00.0,"1,97125","1,97
14","1,970
9","1,9709
5",-1
2007-01-02 12:02:00.0,"1,97095","1,97
13","1,970
9","1,9713
",-1
2007-01-02 12:03:00.0,"1,9713","1,971
3","1,9711
","1,97115
",-1
2007-01-02 12:04:00.0,"1,97115","1,97
115","1,97
09","1,971
",-1
2007-01-02 12:05:00.0,"1,971","1,9710
5","1,9697
","1,97005
",-1
2007-01-02 12:06:00.0,"1,97005","1,97
005","1,96
97","1,969
9",-1
2007-01-02 12:07:00.0,"1,9699","1,970
05","1,969
7","1,9697
",-1
2007-01-02 12:08:00.0,"1,9697","1,969
8","1,9693
5","1,9697
",-1
2007-01-02 12:09:00.0,"1,9697","1,969
85","1,969
45","1,969
7",-1
2007-01-02 12:10:00.0,"1,9697","1,969
75","1,969
7","1,9697
5",-1
2007-01-02 12:11:00.0,"1,96975","1,96
975","1,96
935","1,96
945",-1
2007-01-02 12:12:00.0,"1,96945","1,96
95","1,969
45","1,969
5",-1
2007-01-02 12:13:00.0,"1,9695","1,969
55","1,969
45","1,969
55",-1
2007-01-02 12:14:00.0,"1,96955","1,96
97","1,969
55","1,969
6",-1
2007-01-02 12:15:00.0,"1,9696","1,969
75","1,969
55","1,969
75",-1
2007-01-02 12:16:00.0,"1,96975","1,97
02","1,969
75","1,970
15",-1
2007-01-02 12:17:00.0,"1,97015","1,97
065","1,97
015","1,97
065",-1
2007-01-02 12:18:00.0,"1,97065","1,97
075","1,97
06","1,970
7",-1
2007-01-02 12:19:00.0,"1,9707","1,970
9","1,9706
","1,9709"
,-1
2007-01-02 12:20:00.0,"1,9709","1,971
1","1,9709
","1,971",
-1
2007-01-02 12:21:00.0,"1,971","1,971"
,"1,97085"
,"1,9709",
-1
Start Free Trial