Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
3 registered members (AndrewAMD, Ayumi, 7th_zorro), 784 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 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: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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 | chip programmers | 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