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
1 registered members (AndrewAMD), 552 guests, and 1 spider.
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
Hedge #466869
07/05/17 10:36
07/05/17 10:36
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Hi,
with Hedge >= 4 I want to be sure that the virtual trade is opened if and only if the real trade have been opened. The only exception should be that Lot have been set to -1.
Trading with CFD it may happen that the asset is not available and the real trade is refused, but the virtual one, opened.

Thank you for the hint

Re: Hedge [Re: MatPed] #466880
07/05/17 17:14
07/05/17 17:14
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline
Serious User
DdlV  Offline
Serious User
D

Joined: Jun 2013
Posts: 1,609
Hi MatPed,

My 2 cents/pesos/shillings/lire/whatever laugh :

When using Virtual Hedging it's the "Boss". The virtual trade will always be opened. That's how Virtual Hedging works. A real trade isn't attempted unless Virtual Hedging decides it's needed.

If you're talking the Z systems, I started a similar thread re. Hedge=5 and Margin=0. The result there was that Virtual Hedging takes precedence and real positions will be adjusted to match as time goes by, even if it means opening a new real trade even though Margin=0. So, if a real trade can't be entered, Virtual Hedging will still know that it's needed and attempt to fix it (on the real side) at a future bar.

If you're talking your own strategy, presumably via receiving the error message from the real side, or by a for(open_trades) loop, you can determine if virtual & real are out of sync, and then decide what to do. One of the choices would be to manually close virtual trade(s) as needed. But jcl will have to comment if there are any gotchas in manually closing virtual trades outside of Virtual Hedging's processes...

Regards.

Re: Hedge [Re: DdlV] #466883
07/05/17 19:38
07/05/17 19:38
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Hi DLV,
what you say makes sense and is stated in the manual.
Trading my own cfd strategy I'd like to know if there is a way to override this behavior. It will save a lot of headache in developing.

Closing the virtual trade after an error will work, but will produce an altered equity line of the Asset/Algo so equity line control will be less accurate.

I hope that JCL will find a way...

Re: Hedge [Re: MatPed] #466893
07/06/17 09:02
07/06/17 09:02
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
If a real trade was rejected or was externally closed, Zorro will attempt to open it again at the next trade with that asset. If you want to close the virtual trade instead, let your script compare LotsPool and LotsPhantom, and cancel the virtual trade accordingly. I do not think that this has an effect on the accuracy of the equity.

Re: Hedge [Re: jcl] #466903
07/06/17 19:42
07/06/17 19:42
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
Originally Posted By: jcl
If a real trade was rejected or was externally closed, Zorro will attempt to open it again at the next trade with that asset.


I guess you mean ...at the next bar... yes, and this is great

Originally Posted By: jcl
If you want to close the virtual trade instead, let your script compare LotsPool and LotsPhantom, and cancel the virtual trade accordingly. I do not think that this has an effect on the accuracy of the equity.


yes it will affect the equity: you will have a +1 number of trades with a small loss or profit. The virtual trade will be always open regardless the real asset availability. This is why a was asking a previous check. If you have any hint on this it will be great.

just immagine a psudo-code like:

tradeIsGood = enterLong();
If (tradeIsGood ) enterVirtual(tradeIsGood);

In this case any wrong virtual opening will be avoided. I understand this will limit the Hedge = 5 setting. This is the reason because I was asking for something that will simplify "is the asset available" topic.

Thank you in advance

Re: Hedge [Re: MatPed] #466907
07/07/17 06:41
07/07/17 06:41
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
A cancelled trade has no loss or profit, so I would see no problem with that solution.

Re: Hedge [Re: jcl] #466909
07/07/17 09:06
07/07/17 09:06
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
I did not get it.
If I exit an open trade (exitLong) right after having opened it a loss is generated anyway: the spread.

Am I wrong?

Last edited by MatPed; 07/07/17 21:28.
Re: Hedge [Re: MatPed] #466913
07/07/17 12:46
07/07/17 12:46
Joined: Jun 2013
Posts: 1,609
D
DdlV Offline
Serious User
DdlV  Offline
Serious User
D

Joined: Jun 2013
Posts: 1,609
Hi jcl. I think I see what MatPed is asking:

Does "canceled" mean the Virtual trade is undone as if it had never been attempted, and so it becomes a non-entity and doesn't affect anything else?

Or does "canceled" mean the Virtual trade is closed normally (f.i. via exitTrade), and therefore it has some result (likely negative due to Spread at least), and therefore affects Equity, etc.?

Thanks.

Re: Hedge [Re: DdlV] #466956
07/10/17 16:17
07/10/17 16:17
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
It is the former.

Re: Hedge [Re: jcl] #466974
07/11/17 07:23
07/11/17 07:23
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline OP
User
MatPed  Offline OP
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
ok, there is particular way to cancel a virtual trade or a standard exitLong/Short will make the trick?

Thank you

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