Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (7th_zorro, AndrewAMD, TedMar), 837 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A winning long trade produces loss?! #468930
10/28/17 00:58
10/28/17 00:58
Joined: Sep 2017
Posts: 235
H
Hredot Offline OP
Member
Hredot  Offline OP
Member
H

Joined: Sep 2017
Posts: 235
Consider the following long trade with SPX asset over almost a year time period:
(it is definitely long, since the script is only capable of opening long trades)



The asset grew over $100 in value between enter time and exit time.
Surely, simulated slippage and transaction costs cannot be that huge as to make this a losing trade! oO
What do you think is going on?

Here is what the log says about it (its the last Long entry in 2010 and first Sell after that in 2011):
Quote:
[92422: Wed 10-09-08 14:10] -522 0 0/11 (1099.40)
[92423: Wed 10-09-08 14:20] -522 0 0/11 (1099.10)
[92424: Wed 10-09-08 14:30] -522 0 0/11 (1099.90)
[SPX500::L2401] Long 1@1101.76 at 14:30:00

[92425: Wed 10-09-08 14:40] -522 +0.11908203 1/11 (1101.60)
[92426: Wed 10-09-08 14:50] -522 -1.19 0/12 (1102.40)
[92427: Wed 10-09-08 15:00] -522 -1.01 0/12 (1100.90)
...
...
...
[124244: Thu 11-08-04 19:20] -522 -65.59 0/12 (1222.40)
[124245: Thu 11-08-04 19:30] -522 -71.68 0/12 (1216.40)
[SPX500::L2401] Sell 1@1210.36: -70.85 at 19:30:00

[124246: Thu 11-08-04 19:40] -592 0 0/12 (1209.40)
[124247: Thu 11-08-04 19:50] -592 0 0/12 (1211.60)


The log says the price was indeed over $100 above the entry point, but the profit somehow deteriorated to -$70.85!!
How is this possible?
Is this a bug, or am I being stupid not seeing something?

Last edited by Hredot; 10/28/17 01:27.
Re: A winning long trade produces loss?! [Re: Hredot] #468931
10/28/17 01:38
10/28/17 01:38
Joined: Feb 2017
Posts: 1,731
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,731
Chicago
What’s on your AssetFix line? Also, is this a CFD?

Re: A winning long trade produces loss?! [Re: AndrewAMD] #468932
10/28/17 01:46
10/28/17 01:46
Joined: Sep 2017
Posts: 235
H
Hredot Offline OP
Member
Hredot  Offline OP
Member
H

Joined: Sep 2017
Posts: 235
Wait, I don't know what AssetFix line means. I'm just using the SPX500 setting in the dropdown menu in Zorro (perhaps that is what you mean by "AssetFix line"?). Don't know if thats a CFD. And i'm using the minute spaced data for it that I got from the Zorro home page. But I'm using BarPeriod = 10;

Last edited by Hredot; 10/28/17 05:25.
Re: A winning long trade produces loss?! [Re: Hredot] #468939
10/28/17 12:32
10/28/17 12:32
Joined: Feb 2017
Posts: 1,731
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,731
Chicago
Check this out:
http://zorro-project.com/manual/en/account.htm

And it’s History/AssetsFix.csv. Mea culpa.

OK, try adding this to your script, and see if it's better:
Code:
Spread = RollLong = RollShort = Commission = Slippage = 0;


Re: A winning long trade produces loss?! [Re: AndrewAMD] #468940
10/28/17 13:28
10/28/17 13:28
Joined: Sep 2017
Posts: 235
H
Hredot Offline OP
Member
Hredot  Offline OP
Member
H

Joined: Sep 2017
Posts: 235
Once I added your code line, the trade now indeed comes out positive!
And you are right, under the link you show the SPX500 is listed as a CFD.
Is that something that can happen to CFDs? oO I don't know how they work.
Is there a quick way to understand why something like this can happen to CFDs?

EDIT:

OK, under AssetsFix.scv I see that SPX500 has a -0.5 on RollLong, which probably means that it has automatic accumulating costs for going long over time!!!
Why would anyone want to trade this? What would be the appeal?

Last edited by Hredot; 10/28/17 13:36.
Re: A winning long trade produces loss?! [Re: Hredot] #468942
10/28/17 14:43
10/28/17 14:43
Joined: Feb 2017
Posts: 1,731
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,731
Chicago
Aren't CFD rollover fees different for every broker? Make sure you do your due diligence.

In any case, they are far less regulated than futures and stocks, and they are not legal to trade in US accounts. So I'll say it has the "Wild West" appeal.

Re: A winning long trade produces loss?! [Re: AndrewAMD] #468944
10/28/17 17:44
10/28/17 17:44
Joined: Jul 2017
Posts: 785
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 785

The primary appeal of CFDs would be their small min. trade size, typically equal to 1x of an Index.(ES is 50x). With this, position sizing can be implemented in much smaller steps as dictated by the sizing algo.
CFD's price is closer to the cash index; they also do not require rollovers.
https://ibkr.info/node/1984

Re: A winning long trade produces loss?! [Re: Zheka] #468949
10/28/17 22:54
10/28/17 22:54
Joined: Sep 2017
Posts: 235
H
Hredot Offline OP
Member
Hredot  Offline OP
Member
H

Joined: Sep 2017
Posts: 235
Thanks for the info guys!
I don't know why the AssetFix file had the negative rollover setting for long trades, so I fixed it now. Good to have figured things out!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1