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
1 registered members (degenerate_762), 1,098 guests, and 2 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
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,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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

Chief Engineer
jcl  Offline

Chief Engineer

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

Chief Engineer
jcl  Offline

Chief Engineer

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

Re: Hedge [Re: MatPed] #466979
07/11/17 11:06
07/11/17 11:06
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
No, with "cancel" I mean the command, which is different to "exit".

http://manual.zorro-project.com/sellong.htm

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

Joined: Feb 2015
Posts: 652
Milano, Italy
Thank you Jcl I missed that function, but still I do not get it.

In Trade mode and Hedge = 5
If I enterLong() a trade while the asset is not available from the broker, should I treat this case specifically or is already handled by Zorro i.e. Zorro will repeat try to open the trade or adjust the pool accordingly?

If is not the former can you suggest me the proper way to handle it?

Thank you for your patience

Re: Hedge [Re: MatPed] #466984
07/11/17 12:35
07/11/17 12:35
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Do you mean an asset that is generally not available, or just temporarily?

If only temporarily, I see not what you needed to do. Just wait until the positions are in sync again when a trade with that asset is opened the next time.

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

Joined: Feb 2015
Posts: 652
Milano, Italy
yes only temporarily. Ok 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