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
5 registered members (TipmyPip, AndrewAMD, Quad, aliswee, degenerate_762), 970 guests, and 4 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
Margin too high?? #446465
10/16/14 14:05
10/16/14 14:05
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
I have been testing a strategy that gives decent results in backtest with WFO. I'm confident that it is not curve-fitted as my trade-to-parameter ratio is high and parameters are robust across a range of values. In my backtest, my maximum drawdown is about 15%.

I'm trading it on a demo account, and to me the strategy seems to be taking positions out of proportion to the account size. The account balance is $10k and the strategy is risking almost 10% of this on some trades. For others, it risks as little as 1.5%. The strategy's win ratio is less than 50%, so risking as much as 10% per trade would surely not give a maximum drawdown of only 15%!

I'm actually using a fraction of optimal F, and reinvesting as per the square root rule. I've also tried setting the Risk parameter to a small percentage of the balance to limit the position sizes, but this only has a small effect on the backtest results - I would expect something more significant.

My questions:

1. jcl, could there be another bug in the MT4 bridge that causes excessive position sizing, like the bug that didn't honour the exitLong() and exitShort() functions?

2. Do these trade sizes seem excessive to anyone else? Should I just trust the optimal F factors? Anyone run across anything similar?

Re: Margin too high?? [Re: boatman] #446467
10/16/14 14:49
10/16/14 14:49
Joined: Jan 2013
Posts: 68
I
ibra Offline
Junior Member
ibra  Offline
Junior Member
I

Joined: Jan 2013
Posts: 68
Hi!

What is the "trade-to-parameter ratio and where can I read about it?

Thanks!

Re: Margin too high?? [Re: ibra] #446480
10/17/14 01:45
10/17/14 01:45
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
"Trade-to-parameter ratio" simply refers to the number of trades in the simulation per parameter that is optimized, per asset used in the strategy. Having too few trades per optimized parameter in the backtest can lead to results that are not statistically robust.

The "Train mode" page in the manual (search "optimization") suggests 20 trades per parameter per asset as a rule of thumb. Ehlers suggests a minimum of 30 in his most recent book.

I'm sure that a google search on optimization/curve fitting would reveal more.

Hope that helps.

Re: Margin too high?? [Re: boatman] #446481
10/17/14 01:48
10/17/14 01:48
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
As an update, I've done some calculations, and it turns out that my position sizing is out by a factor of 10 in live trading. I assume that this is related to a conversion error of the "Lot" parameter in the Assets.dta file between Zorro and MT4 via the bridge. As a work around, I will apply a factor of 0.1 to my margin calculation.

I found that this error occurs on my ThinkForex account, but not on my Global Prime account.

Re: Margin too high?? [Re: boatman] #446482
10/17/14 03:10
10/17/14 03:10
Joined: Dec 2013
Posts: 82
Sydney, NSW
T
Thirstywolf Offline
Junior Member
Thirstywolf  Offline
Junior Member
T

Joined: Dec 2013
Posts: 82
Sydney, NSW
Boatman

Is the leverage on both accounts the same?

Re: Margin too high?? [Re: Thirstywolf] #446484
10/17/14 06:21
10/17/14 06:21
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Hi Thirstywolf, no the leverages are different. How would that affect things? Shouldn't Zorro detect the account's leverage when it connects to the broker?

Re: Margin too high?? [Re: boatman] #446490
10/17/14 14:39
10/17/14 14:39
Joined: Apr 2013
Posts: 57
3
3DCat Offline
Junior Member
3DCat  Offline
Junior Member
3

Joined: Apr 2013
Posts: 57
can you check if its with certain assets only? I got the same problem but only with USOil and via the FXCM API

Re: Margin too high?? [Re: 3DCat] #446492
10/17/14 16:08
10/17/14 16:08
Joined: Dec 2013
Posts: 82
Sydney, NSW
T
Thirstywolf Offline
Junior Member
Thirstywolf  Offline
Junior Member
T

Joined: Dec 2013
Posts: 82
Sydney, NSW
Boatman,

I would assume so. Just trying to think of what other potential differences between the two accounts that would lead to an error in margin size, other than lots. However lots does seem most likely, given it is a multiple of 10 difference.

Re: Margin too high?? [Re: Thirstywolf] #446542
10/20/14 17:34
10/20/14 17:34
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Check the assets.dta from both accounts, and compare with the values published by your broker. Wrong parameters, such as a wrong minimum margin or a wrong lot size, can cause a wrong margin, but those wrong parameters are then visible in assets.dta.

Re: Margin too high?? [Re: jcl] #446558
10/21/14 02:04
10/21/14 02:04
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline OP
Senior Member
boatman  Offline OP
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Thanks everyone for the suggestions.

I've found that the problem lay not with the account leverage, but with the OptimalF values assigned to the various assets during training. I made the mistake of training the strategy with capital reinvestment enabled, and this gave OptimalF values that were far to high (approximately one order of magnitude greater in most cases). When I trained the strategy with no re-investment, I got more sensible OptimalF values.

I get a sense of why this is the case, but if someone can offer a succinct explanation I'd be most appreciative!

This leads me to another potential problem:

If I have a strategy that I am trading, but want to re-train at regular intervals, how could I exclude capital reinvestment from the re-training process so as not to distort the OptimalF values? I'm thinking something like

if (not(Retrain))
Margin = OptF * Capital * sqrt(1 + ProfitClosed/Capital);

Sound correct?

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1