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
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 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
Error 010: Invalid Margin == -1$ #448779
02/21/15 09:30
02/21/15 09:30
Joined: Feb 2014
Posts: 180
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 180
Hello. When I backtest a particular script strategy, I get this error message.

I have tried setting the margin to various values and get this error every time towards the end of the test.

[12599] Error 010: Invalid Margin == -1$
[12600] Error 010: Invalid Margin == -1$
[12602] Error 010: Invalid Margin == -1$
[12602] Error 010: Invalid Margin == -1$
[12603] Error 010: Invalid Margin == -1$
[12603] Error 010: Invalid Margin == -1$
[12606] Error 010: Invalid Margin == -1$
Monte Carlo Analysis... Median AR 24%
Profit 237$ MI 27$ DD 453$ Capital 667$
Trades 351 Win 20% Avg +4.6p Bars 152
CAGR 70% PF 1.19 SR 0.47 UI 102% R2 0.00
Generate Chart - please wait... ok

Re: Error 010: Invalid Margin == -1$ [Re: RTG] #448807
02/21/15 21:34
02/21/15 21:34
Joined: Feb 2014
Posts: 73
Montreal, Qc Canada
F
Finstratech Offline
Junior Member
Finstratech  Offline
Junior Member
F

Joined: Feb 2014
Posts: 73
Montreal, Qc Canada
I had this issue before.
In my case, it looked like the system ran out of funds and could not take on any new trades, hence the error.

Re: Error 010: Invalid Margin == -1$ [Re: Finstratech] #448821
02/22/15 10:33
02/22/15 10:33
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline
Senior Member
boatman  Offline
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
Try increasing your starting capital to accommodate a larger margin. For example, if currently you set Capital = 1000, try Capital = 10000.

You can also try reducing the margin you are outlaying on a trade. For example, try Margin = 0.1 * (your current margin settings).

Re: Error 010: Invalid Margin == -1$ [Re: boatman] #448829
02/22/15 16:40
02/22/15 16:40
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
The margin can become invalid due to your calculation method, f.i. when you get a negative square root.

Example:

Margin = OptimalF * Capital * sqrt(1 + ProfitClosed/Capital);

Margin becomes invalid when ProfitClosed is negative and exceeds the Capital. For fixing this, you could just prevent a square root below 1:

Margin = OptimalF * Capital * sqrt(1 + max(0,ProfitClosed)/Capital);

Re: Error 010: Invalid Margin == -1$ [Re: jcl] #448835
02/23/15 00:29
02/23/15 00:29
Joined: Feb 2014
Posts: 180
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 180
Thanks. I was looking in the wrong place.

I was wondering how margin could get a negative value and assumed either optimalF or capital were generating the problem.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1