Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Processing Tick data for zorro strategy #474708
10/31/18 11:30
10/31/18 11:30
Joined: Sep 2018
Posts: 8
A
adityam Offline OP
Newbie
adityam  Offline OP
Newbie
A

Joined: Sep 2018
Posts: 8
Hello,
I have written a strategy using 1-minute OHLC data (date,time,open,high,low,close,volume). However, I am unable to code the same strategy on a tick-by-tick data (date,time,tradedPrice,volume). I am trying to play with barPeriod values e.g. 1./60 but the program is asking for the t1 file instead of a t6 file. The document says that lesser than 1 minute is processed by t1 file however also mentions using barPeroid < 1 for lower intervals. afaik t1 is used for ask/bid spread analysis. Is there a place I can refer for this to understand fully how to work with tick data?
Thanks

Re: Processing Tick data for zorro strategy [Re: adityam] #474725
11/01/18 13:02
11/01/18 13:02
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Yes, for a 1-second bar periods you'll need history in .t1 format. .t6 files contain candles and are not suited for small bar periods.

Re: Processing Tick data for zorro strategy [Re: jcl] #474768
11/05/18 09:40
11/05/18 09:40
Joined: Sep 2018
Posts: 8
A
adityam Offline OP
Newbie
adityam  Offline OP
Newbie
A

Joined: Sep 2018
Posts: 8
Thanks for input. Is there a sample in zorro scripts that can help getting a t1 from a csv file (format: date-yyyymmdd, time-hh:mm:ss, price, vol) e.g. (20180917,15:29:59,11396.05,375)? There was an available script to help convert a csv to t6 however i couldn't find one for t1. Any help with this is appreciated.

Thanks

Last edited by adityam; 11/05/18 09:41.
Re: Processing Tick data for zorro strategy [Re: adityam] #474780
11/05/18 15:43
11/05/18 15:43
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
The script is different for any CSV, but here's a more complex example for bitcoin prices:

Code:
void main()
{
  string Format = "+0,,,%t,f,f,s";
  int Records = dataParse(1,Format,"History\BTCEUR.csv");
  printf("n%d records read",Records);
// now convert it to t1 and change sign for sell quotes
  for(i=0; i<Records; i++) {
    T1* t1 = dataAppendRow(2,2);
    t1->time = dataVar(1,i,0);
    t1->fVal = dataVar(1,i,1);
    string sell = dataStr(1,i,3);
    if(sell[0] == 't') t1->fVal = -t1->fVal;
// display progress bar and check [Stop] button
    if(!progress(100*i/Records,0)) break;
  }
  if(Records) dataSave(2,"History\BTCEUR.t1");
}


Re: Processing Tick data for zorro strategy [Re: jcl] #474803
11/06/18 08:11
11/06/18 08:11
Joined: Sep 2018
Posts: 8
A
adityam Offline OP
Newbie
adityam  Offline OP
Newbie
A

Joined: Sep 2018
Posts: 8
Just to be sure if T1 format is the right format for this usecase.
typedef struct T1
{
DATE time; // time stamp, GMT
float fVal; // positive for ask, negative for bid
} T1; // single-stream tick, .t1 file content

T1 format has these 2 values i.e time and fVal where fVal is ask or bid price, however the format that i have in csv has (date, time, tradedPrice, volume) and T1 format doesn't seem to handle it. How would T1 handle this format then?

Re: Processing Tick data for zorro strategy [Re: adityam] #474804
11/06/18 09:08
11/06/18 09:08
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
T1 does not contain volume. If you want volume, you must indeed use a .t6 file. You can then ignore the warning message that .t1 is recommended.

Re: Processing Tick data for zorro strategy [Re: jcl] #474897
11/12/18 06:40
11/12/18 06:40
Joined: Sep 2018
Posts: 8
A
adityam Offline OP
Newbie
adityam  Offline OP
Newbie
A

Joined: Sep 2018
Posts: 8
Thanks for this information.
I still cannot process the data that i have with the t6 file. The problem i have is as below.
Input csv file is of format (date, time, tradedPrice, volume) e.g. 20180917,15:30:00,11395.1,300
however when i use csvToHistory.c script with following string format
string Format = "%Y%m%d,%H:%M:%S,f4,f6";
I get error Error 062: No 7 records in C:UsersAdministratorZorroHistoryNIFTY_I_TICK_2018.t6
Can't open C:UsersAdministratorZorroHistoryNIFTY_I_TICK_2018.t6

T6 file needs all 7 entries date, time, open, high, low, close, volume etc.
And if i use following format string:
string Format = "+%Y%m%d,%H:%M:%S,f3,f1,f2,f4,f6,f5";
Assuming the open (f3) and high (f1) would contain price and volume respectively and trying to use priceOpen() and priceHigh() to print the price and vol values results zero for both.
How do i then use csvToHistory script to process the csv file of above format and use it in my script?

Thanks

Last edited by adityam; 11/12/18 07:56.
Re: Processing Tick data for zorro strategy [Re: adityam] #474942
11/14/18 12:56
11/14/18 12:56
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Look into the resulting t6 file with the History script or the ZHistoryEditor. Then you see which fields are wrong, and can fix the format string accordingly.

Re: Processing Tick data for zorro strategy [Re: jcl] #474958
11/15/18 03:40
11/15/18 03:40
Joined: Sep 2018
Posts: 8
A
adityam Offline OP
Newbie
adityam  Offline OP
Newbie
A

Joined: Sep 2018
Posts: 8
Thanks Jcl,
As mentioned in previous comment, the t6 file look ok to me. It has proper time and open, high fields populated and rest are zero. However when i try to get these values from script using priceOpen() it doesnt return the values displayed in t6 files but zero.

Output of t6 file from history script is as below:

Date Open High Low Close Val Vol
18-09-17 09:15 11481 3450.0 0.0 0.0 0.0 0

In my script i use:
var Open = priceOpen();
var High = priceHigh();
to get these values but it returns zero instead of 11481 and 3450.0

Anything else that i can try to figure out the issue?

Re: Processing Tick data for zorro strategy [Re: adityam] #474964
11/15/18 09:57
11/15/18 09:57
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
That's not a valid OHLC file. The Open can not be higher than the High, nor can Low and Close be zero.

Re: Processing Tick data for zorro strategy [Re: jcl] #474980
11/15/18 20:15
11/15/18 20:15
Joined: Sep 2018
Posts: 8
A
adityam Offline OP
Newbie
adityam  Offline OP
Newbie
A

Joined: Sep 2018
Posts: 8
So do you mean to say that the following format cannot be handled via a t6 format?
Date,time,price,vol
20180917,15:29:59,11396.05,375
Because whichever format is used the t6 would need OHLC values which the above file doesn't have?
If yes then how can this be handled?

Re: Processing Tick data for zorro strategy [Re: adityam] #474983
11/15/18 22:08
11/15/18 22:08
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
You must store the price in OHLC and the volume in Vol.

Re: Processing Tick data for zorro strategy [Re: adityam] #481784
10/30/20 18:42
10/30/20 18:42
Joined: Oct 2020
Posts: 7
A
AVL Offline
Newbie
AVL  Offline
Newbie
A

Joined: Oct 2020
Posts: 7
Originally Posted by jcl
T1 does not contain volume. If you want volume, you must indeed use a .t6 file. You can then ignore the warning message that .t1 is recommended.

Is there a reason why developers decided not to include Volume (Ask/Bid Size) in .t1 format? Isn't it illogical to exclude it from format made for high-precision backtesting? In this case, backtester is not checking whether an order was filled, so it's not a high precision backtesting. Even Multicharts is considering Volume in tick-by-tick backtesting.

Re: Processing Tick data for zorro strategy [Re: AVL] #481786
10/30/20 19:06
10/30/20 19:06
Joined: Oct 2020
Posts: 7
A
AVL Offline
Newbie
AVL  Offline
Newbie
A

Joined: Oct 2020
Posts: 7
I've created a thread regarding the issues with tick data: https://opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=481785&#Post481785

Page 1 of 2 1 2

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1