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
4 registered members (dBc, clonman, TipmyPip, 1 invisible), 18,936 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
Trade managment function: BADFREE2: SYS error message #440548
04/27/14 20:21
04/27/14 20:21
Joined: Jul 2013
Posts: 3
M
michas Offline OP
Guest
michas  Offline OP
Guest
M

Joined: Jul 2013
Posts: 3
Im an trying to set the STOP value during a trade to be a percentage of the highest high of the price since entering the trade. That way if the price reaches a maximum during the trade, the trade would be closed if the price falls below the given percentage of that maximum (e.g. 95%).

Im trying to program this in a trade managment function (TMF) slightly modified from the example in the Zorro help. The trade should be closed if the price falls below 95% of the maximum price in the trade

int AdjustMax()
{
if(TradeIsOpen and TradeResult > 0)
TradeStopLimit = 0.95*HH(TradeTime);
return 0;
}

When I am testing this, Zorro always crashes with the following error:

BADFREE2: SYS

To me this looks like a memory overflow or someting related. For this reason I checked which values are accepted as a argument of HH. This seems to work fine for periods until 82 bars, with bigger numbers Zorro crashes.

What is happening? How could I change the code? Is there a dedicated function to achieve what I want, which I missed?

Re: Trade managment function: BADFREE2: SYS error message [Re: michas] #440591
04/28/14 14:34
04/28/14 14:34
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Yes, the error message is a memory overflow. It's caused by a wrong parameter to HH. You must set LookBack high enough to cover the maximum TradeTime.

Originally Posted By: manual
Make sure that LookBack is always higher than the maximum TimePeriod plus the UnstablePeriod plus the highest offset of all series.


Moderated by  Petra 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1