Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (ozgur, EternallyCurious, howardR, 1 invisible), 623 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 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,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
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,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
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,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
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,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
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


Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1