Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
4 registered members (AndrewAMD, fogman, Grant, juanex), 972 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to determine Margin in use / available? #433722
12/05/13 11:30
12/05/13 11:30
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
Is there a variable that keeps track of total Margin in use and/or available?

I would like to printf a warning when Zorro is unable to take new trades, due to inadequate Margin available.

Thanks

Re: How to determine Margin in use / available? [Re: dusktrader] #433723
12/05/13 11:43
12/05/13 11:43
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
I think I found it... when I search the manual for MarginVal.

One question I do still have:
if I am simply setting my Margin to be based on the OptimalF, what happens when there is not enough margin available?

Will Zorro:
a) not try to place an order at all
b) place a reduced-size order
or c) attempt to place a full-size order and get rejected by broker?

The condition I'm trying to detect is when Zorro wants to place an order, but can't due to not enough available margin.

Re: How to determine Margin in use / available? [Re: dusktrader] #433724
12/05/13 12:11
12/05/13 12:11
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Normally Zorro does not check your account before placing a trade, so you'd need to do that by script.

There's one exception: when the MARGINLIMIT flag is set, Zorro doesn't enter a new trade when the trade margin plus the trade risk exceeds the available margin left in the account. But this is a rather crude condition - finer adaption of the margin to the account size should be done by script.

Re: How to determine Margin in use / available? [Re: jcl] #433725
12/05/13 13:23
12/05/13 13:23
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
Ok. If Zorro does not check the available margin, then that implies that during simulation, it would just assume all trades can be taken. That would then affect the "Capital required" figure, correct?

If that is correct, then presumably while live trading Zorro would proceed in the same fashion, attempting to take all trades with the live broker. If the live trading commenced within the statistical bounds of the simulation, then it should behave the same in live as tested in simulation (correct?)

Of course... I think this also implies that if live trading did NOT commence within the same statistical bounds of the simulation... then Zorro could attempt to take trades that the live broker would not allow. And thus the live account would be at risk of being denied opening a trade, or even a margin call.

(Please correct if I'm misunderstanding any of this)

Re: How to determine Margin in use / available? [Re: dusktrader] #433727
12/05/13 15:48
12/05/13 15:48
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Yes, that's absolutely correct.

Re: How to determine Margin in use / available? [Re: jcl] #433768
12/06/13 15:06
12/06/13 15:06
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
I was thinking about this yesterday, and it occurred to me... that a multi-asset strategy has a sort of built-in "black swan protection" LOL.

They say that during black swan events, in general, markets tend to "sell off". Presumably they are talking about equity markets here. Because I don't see how currency markets could really sell off.

By trading multiple currencies, and preferably not too heavily weighted in any particular currency, it would seem that you are somewhat hedged against chaos. While one currency declines, another may increase. If both in the pair declined, then I think the pair value would just flatline.

Is this wrong logic?

Re: How to determine Margin in use / available? [Re: dusktrader] #433771
12/06/13 17:34
12/06/13 17:34
Joined: May 2013
Posts: 245
S
swingtraderkk Offline
Member
swingtraderkk  Offline
Member
S

Joined: May 2013
Posts: 245
Not sure about this logic, there would be a flight of speculative money out of all types of assets incl. currency pairs into cash.

This may be good in theory for reserve currencies, but it assumes your algos somewhat effectively hedge themselves and that you can get your longs filled on rising reserve currencies when everything else is collapsing - fills and spreads are the biggest issue with black swan events.

Using optf to determine position size based on the algos performance in normal conditions is unlikely to give you anything approaching a reasonable hedging for a black swan event.



My own thoughts on this would be that hedging against black swans is better achieved by options. See them as a monthly/quarlterly insurance policy against a black swan and just let the algos run as best they can. Calculating your black swan risk for your option strategy, now I only wish I could calculate that properly ;-)


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1