Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, 1 invisible), 584 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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: 181
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

Joined: Feb 2014
Posts: 181
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,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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: 181
R
RTG Offline OP
Member
RTG  Offline OP
Member
R

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