Bar = NumBars results in Error030

Posted By: gamadeus

Bar = NumBars results in Error030 - 02/07/19 08:48

When I set Bar = NumBars according to the manual to abort the simulation I get an Error030. Is that supposed to happen?

Bar=Endbar works too, but then the last bar still gets executed, so its less clean.
Posted By: jcl

Re: Bar = NumBars results in Error030 - 02/07/19 09:11

Bar = NumBars is an unusual way to abort the simulation. Normally you call quit(). ON which manual page have you found this? And can you post your code?
Posted By: gamadeus

Re: Bar = NumBars results in Error030 - 02/07/19 09:19

Dont know which Page, but you can find it in Help if you query NumBars.

It says:
...... Setting Bar = NumBars aborts the simulation. Use this hack at own risk since TimeFrame and series do not consider bars that are skipped this way.

My code can be found in the thread I started before "LookBack and StartBar"
Its really nothing fancy, just testing and printing Bar and timestamps.

Thanks anyway for the tip! The only problem with quit() is that it is not calling objective or evaluate functions, it seems. Any way around that?
Posted By: gamadeus

Re: Bar = NumBars results in Error030 - 02/07/19 12:48

Ok according to the manual quit sets the EXITRUN flag and calls evaluate, so that’s fine

Unfortunately an even bigger problem is that it stops all cycles too. According to the manual it continues with the next cycle if a text is added as function parameter. However that does not seem to work, quit always results in a dead stop.
Is that information correct?
Posted By: gamadeus

Re: Bar = NumBars results in Error030 - 02/08/19 08:17

jcl can you please let me know if quit() is supposed to work as advertised in the manual, i.e. call the next cycle if a text is given?
or is that only working for Zorro S now?
that would really really be helpful for what I am trying to do

meanwhile I am trying to work with:

for(open_trades) exitTrade(ThisTrade);
Bar = EndBar;
return;

but this is much less clean and causes problems
Posted By: jcl

Re: Bar = NumBars results in Error030 - 02/09/19 07:16

Yes, quit is supposed to work as described and has nothing to do with Zorro S. But setting Bar is indeed an ugly hack. I'll remove that from the manual. If you have problems with quit, you can contact Support with your script and they'll look into it.
Posted By: gamadeus

Re: Bar = NumBars results in Error030 - 02/10/19 12:00

Thanks jcl.
That problem with quit really has nothing to do with my script.

Here is a sample script which is as basic as it can get. I would expect this to run 4 times but it only runs once:

function run()
{
NumTotalCycles = 4;
if(tod() == 400) quit("its 4 am");
}

Isn´t quit supposed to call the next TotalCycle with a setup like this?
Posted By: jcl

Re: Bar = NumBars results in Error030 - 02/11/19 07:20

Yes, I would also expect that it proceeds to the next cycle. I'll forward this to the developers for looking into it.
Posted By: gamadeus

Re: Bar = NumBars results in Error030 - 02/11/19 17:34

ok thanks, I tested it on 1.96 and 2.02 btw.
© 2024 lite-C Forums