Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by AndrewAMD. 12/02/26 15:26
SGT_FW
by Aku_Aku. 11/30/26 08:19
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 7,381 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 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,150
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,150
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