Error 111 - Crash in Script

Posted By: forexcoder

Error 111 - Crash in Script - 03/20/15 13:34

Hi everyone.
What kind of error is this?

Attached picture Zorro_error.JPG
Posted By: yosoytrader

Re: Error 111 - Crash in Script - 03/20/15 13:38

maybe an error in the script coding, can you post the script?
Posted By: MatPed

Re: Error 111 - Crash in Script - 03/20/15 14:46

One of the worst thing, because dubugging in Zorro is "old-style" this have helped me: http://zorro-trader.com/manual/
Posted By: jcl

Re: Error 111 - Crash in Script - 03/20/15 17:18

Originally Posted By: The Mighty Manual

Error 111: Crash in ...

A function in the script crashed due to a wrong operation, such as a division by zero or a wrong array index. The current run is aborted (which can cause subsequent errors, f.i. inconsistent series calls). See Troubleshooting about how to fix bugs in your script and deal with crashes.
Posted By: forexcoder

Re: Error 111 - Crash in Script - 03/21/15 11:12

Thanks all. That is the code:
#define D1 (1440/BarPeriod)//
#define W1 (7200/BarPeriod)//
#define MN1 (30240/BarPeriod)//

Stop = 4*ATR(100);
Trail = 4*ATR(100);
LookBack = 100;
BarPeriod = 60;//
Hedge = 1;
TimeFrame = D1;
vars PriceD1 = series(price());//
TimeFrame = W1;
vars PriceW1 = series(price());
TimeFrame = MN1;
vars PriceMN1 = series(price());

void direzioneLong()
{
if (PriceD1[0]>PriceD1[1])
enterLong();
}

void direzioneShort()
{
if (PriceD1[0]>PriceD1[1])
enterShort();
}
int run()
{

if (PriceMN1[0]>PriceMN1[1] and PriceW1[0]>PriceW1[1] and PriceD1[0]<PriceD1[1])
direzioneLong();
if (PriceMN1[0]<PriceMN1[1] and PriceW1[0]<PriceW1[1] and PriceD1[0]>PriceD1[1])
direzioneShort();
}
Posted By: yosoytrader

Re: Error 111 - Crash in Script - 03/21/15 12:33

Hi forexcoder, I defined the vars arrays as global - outside the run() - and initialized inside the run()
Moreover I get error because of not enough bars to compute the ATR.
Why not use the script skeletons taught in the workshops?
Hope this helps.





#define D1 (1440/BarPeriod)//
#define W1 (7200/BarPeriod)//
#define MN1 (30240/BarPeriod)//

vars PriceD1;
vars PriceW1;
vars PriceMN1;

void direzioneLong()
{
if (PriceD1[0]>PriceD1[1])
enterLong();
}

void direzioneShort()
{
if (PriceD1[0]>PriceD1[1])
enterShort();
}



void run()
{



LookBack = 100;
BarPeriod = 60;
Hedge = 1;

TimeFrame = D1;
PriceD1 = series(price());

TimeFrame = W1;
PriceW1 = series(price());

TimeFrame = MN1;
PriceMN1 = series(price());

Stop = 4*ATR(100);
Trail = 4*ATR(100);

if (PriceMN1[0]>PriceMN1[1] and PriceW1[0]>PriceW1[1] and PriceD1[0]<PriceD1[1])
direzioneLong();
if (PriceMN1[0]<PriceMN1[1] and PriceW1[0]<PriceW1[1] and PriceD1[0]>PriceD1[1])
direzioneShort();
}
Posted By: forexcoder

Re: Error 111 - Crash in Script - 03/22/15 11:00

Thanks very much yosoytrader.
© 2024 lite-C Forums