Crash in script when optimizing

Posted By: Joaquin

Crash in script when optimizing - 04/29/13 16:30

I am fresh new with Zorro. I have developed my very first strategy and seems to work fine, it opens pending orders and updates Trailing Stops correctly.
But I am trying now optimization.
I have set this at the beginning of the script:

set(PARAMETERS);
BarPeriod = 1440;
//...
var sl = optimize(1,0.1,1,0.1) * diff;

And when I click in Train, after some time an error popup emerges saying "Crash in script" and this message is shown in the logs window:
"Parameter 1 step 1: 0.10 => 0.34 52/579"

Any clue why this happens?

Thanks, Zorro is a great tool!
Posted By: Joaquin

Re: Crash in script when optimizing - 04/29/13 20:51

I have noticed that this crash is due to not enough bars to 'learn' to use in the optimization. Is that possible? The script works with 1day bars (barperiod 1440), and if I tune lookback and try different -smaller- timeframes, this error stops emerging.

But, what can I do to make this script working in barperiod 1440 and make optimizations? How can I know how many lookback bars the script needs for calculations?

Thanks to everyone reading this.
Posted By: jcl

Re: Crash in script when optimizing - 04/30/13 07:50

Welcome to the forum. The settings above look normal, so they can by itself not cause a crash. The reason must be somewhere else. Can you post the whole script? Use PM if it's a secret strategy. We'll look into it and fix that crash.
Posted By: Joaquin

Re: Crash in script when optimizing - 04/30/13 08:27

Hi jcl, thanks for the welcome
You're doing an excellent work with this tool, I am beginning to love it!
It seems it was a just an error 'in my side' (the side just in front of the screen) :-)

I come from MetaTrader and things are very different here, I'll just have to get used to it!

I have overwritten the old script, and now it works correctly. I think that the crash I was having could be coming from these sentences:

enterLong(0.1,Close+diff,Close+diff-sl,Close+diff+tp,trailing,50);
enterShort(0.1,Close-diff,Close-diff+sl,Close-diff-tp,trailing,50);

I have modified the script, setting the Stop, TakeProfit and Trail variables before calling enterLong() and enterShort() and now it doesn't crash.

Anyway, thanks for your help!
Posted By: jcl

Re: Crash in script when optimizing - 05/01/13 06:45

You can set Stop etc. also in enterLong. The crash was probably caused by the "0.1" - if you don't give an integer here, enterLong assumes that it's a pointer to a trade function, calls a nonexistent function, and consequently crashes.
© 2024 lite-C Forums