Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, juanex, Grant), 1,018 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Crash when training DTREE #431279
10/12/13 20:06
10/12/13 20:06
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
The following strategy causes Zorro to crash. The crash happens between the 1st and 2nd cycle. There is nothing interesting in the diag file. There are no errors except for the crash.

Code:
function run() {
	NumYears = 2;
	LookBack = 471;
	BarPeriod = 15;
	Stop = 6 * ATR(100);
	TakeProfit = 2 * ATR(100);
	set(RULES);
	Hedge = 2;
	NumWFOCycles = 5;

	MAMA(series(day(2)), 0.24, 0.023);
	var v1 = NumRiseFall(series(rFAMA), 95);
	var v2 = HighPass1(series(Mom(series((var)CDLSpinningTop()), 95)), 64);
	var v3 = HighPass1(series(AO(series(AroonOsc(36)))), 106);
	MACDFix(series(HighPass1(series((var)CDLSpinningTop()), 64)), 104);
	var v4 = rMACDSignal;
	BBands(series(FractalHigh(series(AroonOsc(67)), 102)), 60, 2.5, 2.4, MAType_EMA);
	var v5 = rRealMiddleBand;
	MACDFix(series(priceHigh(3)), 104);
	var v6 = NumRiseFall(series(rMACDSignal), 72);
	StochF(35, 67, MAType_T3);
	var v7 = LinearRegIntercept(series(FractalHigh(series(rFastD), 58)), 111);
	MACDFix(series(LinearRegIntercept(series(day(0)), 111)), 67);
	var v8 = rMACDSignal;

	var input1 = v1 * -0.00110547
	+ v2 * 0.00222760
	+ v3 * 0.04020708
	+ v4 * 0.01128430
	+ v5 * 0.06875866
	+ v6 * -0.16419055
	+ v7 * -0.05423703
	+ v8 * -0.01516895;
	var input2 = v1 * 0.02346427
	+ v2 * -0.00026231
	+ v3 * -0.12346860
	+ v4 * -0.00459414
	+ v5 * 0.01890352
	+ v6 * -0.04114520
	+ v7 * 0.00925573
	+ v8 * 0.01288936;
	var input3 = v1 * -0.02614581
	+ v2 * -0.00536007
	+ v3 * 0.16492536
	+ v4 * -0.00286681
	+ v5 * 0.11514686
	+ v6 * 0.06602972
	+ v7 * -0.09581744
	+ v8 * 0.03452591;
	var input4 = v1 * 0.04176300
	+ v2 * 0.01472879
	+ v3 * 0.09870978
	+ v4 * 0.04768938
	+ v5 * -0.04415341
	+ v6 * -0.07404330
	+ v7 * 0.06831789
	+ v8 * -0.01451993;
	var input5 = v1 * -0.01390801
	+ v2 * 0.04040977
	+ v3 * 0.08363368
	+ v4 * -0.01162885
	+ v5 * -0.00704222
	+ v6 * -0.00270083
	+ v7 * 0.06368790
	+ v8 * -0.00778374;
	var input6 = v1 * 0.05484640
	+ v2 * -0.05112688
	+ v3 * 0.14928488;
	var input7 = v1 * -0.01981788
	+ v2 * 0.10429744
	+ v3 * -0.01295508;
	var input8 = v1 * 0.09492292
	+ v2 * 0.15706923
	+ v3 * -0.03908688;
	var input9 = v1 * -0.34940018
	+ v2 * -0.00191789
	+ v3 * 0.02051273;
	var input10 = v1 * 0.14940054
	+ v2 * -0.04275530
	+ v3 * 0.03295050;

	if(adviseLong(DTREE, 0, input1, input2, input3,
                      input4, input5, input6, input7,
                      input8, input9, input10) > 0) {
          enterLong();
	}
}



Log has
Code:
Rules: bug3  2012..2013
Prediction accuracy: 34%
Rules stored in bug3_EURUSD_1.c



Last few lines of diag file look like they are from Cycle1.
Code:
Trade 2821179
Removed
Trade 2821280
Removed
Trade 2821381
Removed
Trade 2821482
Removed
Trade 2821583
Removed
run 28216
return
Exit Loop TA-Lib Series


Re: Crash when training DTREE [Re: GPEngine] #431315
10/13/13 19:25
10/13/13 19:25
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
I suspected maybe there was a problem installing 1.16 over 1.14 I have tried a clean install of 1.16, copying only the data files. This script still crashes in the same place.

I will try again with a clean History folder. (I download two years from broker, fresh)

But after that, there's not much else I can do on my side.
Can anyone see any problem with this Strategy's syntax? I think it is correct and should run. Does it cause anyone else's Zorro install to crash?

Re: Crash when training DTREE [Re: GPEngine] #431335
10/14/13 10:00
10/14/13 10:00
Joined: May 2013
Posts: 245
S
swingtraderkk Offline
Member
swingtraderkk  Offline
Member
S

Joined: May 2013
Posts: 245
MAMA(series(day(2)), 0.24, 0.023);
MACDFix(series(LinearRegIntercept(series(day(0)), 111)), 67);


no price series is passed to these indicators is that intentional?

Re: Crash when training DTREE [Re: swingtraderkk] #431341
10/14/13 14:10
10/14/13 14:10
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
This system certainly does not look as if it would make a lot of sense, but still, I can not see a crash reason at a first glance.

I'll look into it. It's possibly some internal division by zero or similar problem of the TA-Lib indicators when they are fed with bad data.

Re: Crash when training DTREE [Re: jcl] #431346
10/14/13 14:57
10/14/13 14:57
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Ok, the problem was not the indicators, but the decision tree. From the used signals, no proper tree could be calculated. This caused internally a recursion and a subsequent crash.

This is a bug and will be fixed in the next version, so that it won't crash anymore. However you can already detect such a problem when you look at the created trees in the Data folder. If the prediction accuracy is far below 50%, or if a tree gets thousands of lines, the used signals have no correlation to trade results and should be changed.

Re: Crash when training DTREE [Re: jcl] #431348
10/14/13 15:45
10/14/13 15:45
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
Thank you so much for looking into it! I'm glad you were able to spot the fault.

Not to whine too much, but it took me many hours on my side to be able to isolate this into a simple example. Of course I realize that the example I provided has no merits as a strategy. I am just providing a test case for you. I cannot look at Zorro internals, so I must work backwards and infer and isolate the problem. This one was especially hard because the crash can be made to go away by removing, not adding inputs. Try it -- remove v06 from the advise method. No crash, right? Replace any of the indicators with constant series(0). No crash, right? This was a tough one on my side.

I need Zorro to survive nonsense inputs since I am automatically generating candidate strategies.

As far as I can tell, this crash was not present in 1.14. Please add tests which send nonsense signals to the advise methods. Please add these to your release qualification steps. Thank you.

Last edited by GPEngine; 10/14/13 15:46. Reason: said 1.16, meant 1.14
Re: Crash when training DTREE [Re: GPEngine] #431349
10/14/13 16:08
10/14/13 16:08
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
Here's a shorter and somewhat more realistic example which reproduces the crash.

Code:
function run() {
  StartDate = 20130101;
  EndDate = 20131001;
  AssetList = "AssetsUS.dta";
  LookBack = 900;
  BarPeriod = 4;
  ExitTime = 240;
  Stop = 3.24 * ATR(100);
  TakeProfit = 2.94 * ATR(100);
  set(RULES+TESTNOW);
  NumWFOCycles = 5;
  TradesPerBar = 2;

  var v00 = FIR6(series(Normalize(series(CCI(70)), 140)));
  var v01 = WMA(series(LinearRegAngle(series(PlusDM(79)), 78)), 68);
  var v02 = MidPrice(33);

  if(adviseLong(DTREE, 0, v00, v01, v02) > 0) {
    enterLong();
  }
  if(adviseShort() > 0) {
    enterShort();
  }
}



Crash during Train. Wait for the 4th cycle.

Re: training DTREE [Re: GPEngine] #431350
10/14/13 16:14
10/14/13 16:14
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Thanks, but we don't need more examples.


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