Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, SBGuy, Petra), 801 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Is Zorro's rollover calculation wrong? #464681
03/05/17 14:57
03/05/17 14:57
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
Let's take this minimal example:

Code:
#include <default.c>

function run()
{	
	StartDate = 20170101;
	BarPeriod = 60;
	LifeTime = 25;
	enterShort();
	set(LOGFILE);
}


When I check the trade log it seems that all the trades opened between 13:00 and 22:00 (and closed on the next day) have no rollover despite being held for 25 hours. From what I understand this is not how rollover usually works.

Last edited by pcz; 03/05/17 14:59.
Re: Is Zorro's rollover calculation wrong? [Re: pcz] #464685
03/06/17 09:42
03/06/17 09:42
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
It's indeed not, since there is no way rollover "usually works". Zorro adds rollover at any new day when the trade was longer open than 12 hours, which is a good approximation for most, but not all brokers.

If you need a different rollover calculation for a particular broker, just set RollLong/Short to zero and calculate it in the script.

Re: Is Zorro's rollover calculation wrong? [Re: jcl] #464686
03/06/17 09:57
03/06/17 09:57
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
OK, good to know. Would be nice to have this information in the manual (sorry if I overlooked it by mistake).

Another thing is that for a test trade on EUR/USD opened on 31.12.2015 and closed on 4.1.2016 the calculated rollover is 142160 while the value in AssetFix file is 1.4216. I have no clue why but maybe it has something to do with the year switch?

Re: Is Zorro's rollover calculation wrong? [Re: pcz] #464690
03/06/17 10:40
03/06/17 10:40
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
I have just tried it, but can not confirm a wrong rollover for trades between years. Can you post that script?

Re: Is Zorro's rollover calculation wrong? [Re: jcl] #464692
03/06/17 10:53
03/06/17 10:53
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
I found out that this happens only when the AssetsFix file can't be opened between test runs (e.g. because it has been opened in a text editor). I didn't notice it before. My theory is that Zorro somehow remembered the rollover value from the previous test but not the other asset params. Therefore the value 142160 which is 100k times the right value. So probably it's just an unexpected behavior in unexpected situation, not real issue.

Re: Is Zorro's rollover calculation wrong? [Re: pcz] #464694
03/06/17 11:02
03/06/17 11:02
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Hmm, if the file can not be opened the values are certainly wrong, but did you not get an error message?

Re: Is Zorro's rollover calculation wrong? [Re: jcl] #464695
03/06/17 11:06
03/06/17 11:06
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
Yes, there was a message in Zorro's main window which I didn't notice.

Re: Is Zorro's rollover calculation wrong? [Re: pcz] #464699
03/06/17 14:10
03/06/17 14:10
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
This is somewhat related to the previous observation so I'll put it here.

I want to store RollLong/Short values from AssetsFix file in order to use a different rollover calculation as you suggested.

I have code like this:

Code:
if(is(INITRUN)){
	x = (var)RollShort;
}
RollShort = 0;



This works fine with a fresh Zorro start. But if I re-run the script Zorro remembers that RollShort = 0 from the previous run so the assignment to x variable is useless. Is it like this because of some other feature or would it make more sense to reset the rollover values with each new test run?

Re: Is Zorro's rollover calculation wrong? [Re: pcz] #464702
03/06/17 16:54
03/06/17 16:54
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Load the asset list again with assetList() in the INITRUN. The rollover is then set to the stored parameters from the list.

Re: Is Zorro's rollover calculation wrong? [Re: jcl] #464994
03/23/17 15:12
03/23/17 15:12
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
Another thing related to rollover calculation I've noticed recently, although it's probably not a big issue:

When testing with T1 data I get sometimes different values than with T6 data. Is there a reason for that?

Example:
Code:
Type	        Open	                Close	                Entry	Exit	Profit	Roll
T1: Short	2014-01-10 19:00	2014-01-13 01:00	1.36704	1.3663	8.34	1.42		
T6: Short	2014-01-10 19:00	2014-01-13 01:00	1.36704	1.3663	9.76	2.84

T1: Long	2014-03-14 15:00	2014-03-17 07:00	1.39163	1.39024	-17.94	-4.94		
T6: Long	2014-03-14 15:00	2014-03-17 07:00	1.39163	1.39024	-22.88	-9.88


Re: Is Zorro's rollover calculation wrong? [Re: pcz] #464997
03/23/17 18:15
03/23/17 18:15
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Missing data, possibly. Maybe the T1 data had gaps and therefore less days for the rollover.

Re: Is Zorro's rollover calculation wrong? [Re: jcl] #465002
03/24/17 09:43
03/24/17 09:43
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
In both cases the data are generated from Dukascopy's tick data. I even tried exporting M1 bars for T1 and T6 data and there's not a single difference between them as far as I can tell. It seems though that the difference in rollover calculation occurs only around weekends.

Re: Is Zorro's rollover calculation wrong? [Re: pcz] #465004
03/24/17 17:30
03/24/17 17:30
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Rollover is accumulated at any new day. So I would suspect that for some reason one data set had less day changes, possibly Friday or Sunday, than the other one.

Sum up the open rollover of all open trades and plot or print the result at any bar. Then you can see where the differences come from.

var RollSum = 0;
for(open_trades) RollSum += TradeRoll;

Re: Is Zorro's rollover calculation wrong? [Re: jcl] #465009
03/25/17 16:13
03/25/17 16:13
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
Having this trade:
Code:
Type       Lots	  Open	                Close	                Entry	Exit	Profit	Roll
T1/Short   1	  2015-01-09 11:00	2015-01-12 07:00	0.8136	0.82442	-104.22	-3.03
T6/Short   1	  2015-01-09 11:00	2015-01-12 07:00	0.8136	0.82442	-107.25	-6.06



Printing the trade roll gives me this for T1 data (using hour() and minute() functions when printing; BarPeriod is 60):
Code:
...
2015-01-09 19:00, 0.000000
2015-01-11 23:00, 0.000000
2015-01-12 00:00, 0.000000
2015-01-12 01:00, -3.030200
2015-01-12 02:00, -3.030200
2015-01-12 03:00, -3.030200
2015-01-12 04:00, -3.030200
2015-01-12 05:00, -3.030200
2015-01-12 06:00, -3.030200



For T6 data this:
Code:
...
2015-01-09 19:00, 0.000000
2015-01-11 23:00, 0.000000
2015-01-12 00:00, -3.030200
2015-01-12 01:00, -6.060400
2015-01-12 02:00, -6.060400
2015-01-12 03:00, -6.060400
2015-01-12 04:00, -6.060400
2015-01-12 05:00, -6.060400
2015-01-12 06:00, -6.060400



9.1.2015 was Friday and 12.1. was Monday.

Re: Is Zorro's rollover calculation wrong? [Re: pcz] #465018
03/27/17 09:16
03/27/17 09:16
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
The T6 rollover looks ok. The T1 rollover looks as if there were no prices on Sunday. Can you check if the T1 data had a Sunday gap? Rollover is only added when the asset had a price change since the last rollover.

Re: Is Zorro's rollover calculation wrong? [Re: jcl] #465020
03/27/17 09:57
03/27/17 09:57
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
Both price files (.t1 and .t6) have prices on Sunday. The first Sunday entry in .t1 file has timestamp 2015-01-11 22:00:03.300 and the first entry in .t6 file has timestamp 2015-01-11 22:01. The Weekend variable has its default value in both cases.

Re: Is Zorro's rollover calculation wrong? [Re: pcz] #465023
03/27/17 17:08
03/27/17 17:08
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Hmm, if all is identical, then I do not know why the t1 and the t6 data have different rollover. So someone had to really look into it. If you want, you can send your script and the data sets to Support. They'll find out where the difference comes from.

Re: Is Zorro's rollover calculation wrong? [Re: jcl] #465025
03/27/17 19:30
03/27/17 19:30
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
Thank you jcl, I will.

Re: Is Zorro's rollover calculation wrong? [Re: pcz] #465348
04/20/17 11:43
04/20/17 11:43
Joined: May 2016
Posts: 180
Prague
pcz Offline OP
Member
pcz  Offline OP
Member

Joined: May 2016
Posts: 180
Prague
I got response from the support. The issue was that in TICKS mode a tick in the historical data was evaluated even outside trading hours. It will be fixed in the next version.

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1