Afl Error help

#1
Hi,

Could someone please help me how to fix the Amibroker system crash issue while applying the afl mentioned below.

_SECTION_BEGIN("Range");

per = Param( "Period", 27, 2, 200, 1 );
mult = Param("Range Multiplier",1.618,0.1,2,0.1);

//Average Range

source=Close;

function smoothrng( x, t, m )
{ wper = t * 2 - 1;
Refx=(x - Ref(x,-1));
avrng = EMA(abs(Refx), t);
smoothrng1 = EMA(avrng, wper) * m;
return smoothrng;
};

smrng = smoothrng(source, per, mult);



function rngfilt(x, r)
{ rngfilt1 = x;
rng=Ref(rngfilt1,-1);
xp=x+r;
xn=x-r;
rngfilt1 = IIf(x > rng,IIf( xn < rng,rng, xn, IIf(xp > rng, rng, xp)));
return rngfilt;
};

filt = rngfilt(src, smrng);

---------------------------------



The system crash error message says

Error 47.
Exception occurred during AFL formula execution at address: 423503, code: C0000005

I really don't know what to do could seniors please help me fix this issue.

Thanks,
Allen.
 

Romeo1998

Well-Known Member
#2
Hi,

Could someone please help me how to fix the Amibroker system crash issue while applying the afl mentioned below.

_SECTION_BEGIN("Range");

per = Param( "Period", 27, 2, 200, 1 );
mult = Param("Range Multiplier",1.618,0.1,2,0.1);

//Average Range

source=Close;

function smoothrng( x, t, m )
{ wper = t * 2 - 1;
Refx=(x - Ref(x,-1));
avrng = EMA(abs(Refx), t);
smoothrng1 = EMA(avrng, wper) * m;
return smoothrng;
};

smrng = smoothrng(source, per, mult);



function rngfilt(x, r)
{ rngfilt1 = x;
rng=Ref(rngfilt1,-1);
xp=x+r;
xn=x-r;
rngfilt1 = IIf(x > rng,IIf( xn < rng,rng, xn, IIf(xp > rng, rng, xp)));
return rngfilt;
};

filt = rngfilt(src, smrng);

---------------------------------



The system crash error message says

Error 47.
Exception occurred during AFL formula execution at address: 423503, code: C0000005

I really don't know what to do could seniors please help me fix this issue.

Thanks,
Allen.
In AmiBroker versions prior to v6.13, when SetForeign is used, AmiBroker needs to keep the contents of the foreign symbols in its in-memory cache. If the number of foreign symbols accessed exceeds the cache size then error 47 will be given. You should increase the In-memory cache size in Tools > Preferences > Data. Ensure that "max. symbols" and "max. MegaBytes" have enough size to cache all symbols. Alternatively, upgrade to AmiBroker v6.20.1 or above.
https://norgatedata.com/amibroker-faq.php#error47
https://forum.amibroker.com/t/how-do-i-correct-this-error-47/17496/5
good luck :)
 
#5
Hi Yusi,

Amibroker accepts this afl until this line

rngfilt1 = IIf(x > rng,IIf( xn < rng,rng, xn, IIf(xp > rng, rng, xp)));
return rngfilt;
};

when I entered the last line mentioned below the crash error message pops up
filt = rngfilt(src, smrng);

I also tried without the line starts with (rngfilt1) that you said but not working same error message pops up.
 

Similar threads

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Name:Phone:
Email:City:
State:
Are you a day trader?