Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 15,499 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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: 183
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 183
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: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
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: 183
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 183
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