I have got Error with AFL . Please help me

Hello Experts,

Please help me to fix a problem which I am not able to do for a long time.
No show Error number !!!!
Please let me know the problem here !

Thank you so much !!

My code as below :

_SECTION_BEGIN("MO HINH HOA LOA KEN");
GraphXSpace =25;
Length = 20;
Price = EMA(Close, Length);
Plot(C,"",IIf(C>Ref(C,-1),colorCustom9,colorRed),styleCandle);
Plot(MA( C, 20 ),"MA20",colorYellow,styleLine|styleThick);
Plot(EMA( C, 6 ),"EMA6",colorCustom15,styleThick);
Plot(EMA( C, 10 ),"EMA10",colorCustom9,styleThick);
Plot(EMA( C, 150 ),"EMA150",colorCustom8,styleLine|styleDots);
Plot(MA( C, 65 ),"MA65",colorCustom12,styleLine|styleThick);
Plot(MA( C, 50 ),"MA50",colorCustom11,styleLine|styleThick);
Plot(MA( C, 200 ),"MA200",colorBrown,styleThick);
Plot(MA( C, 250 ),"MA250",ParamColor("Color",colorCustom16),styleThick);
kLength = Length;
kN = 1.5;
kATR = ATR(kLength);
kUpper = Price + kN * kATR;
kLower = Price - kN * kATR;
bbLength = Length;
bbN = 2;
bbStDevValues = StDev(Close, bbLength);
bbUpper = Price + bbN * bbStDevValues;
bbLower = Price - bbN * bbStDevValues;
kUpper2 = Price - kN * kATR;
kLower2 = Price + kN * kATR;
bbUpper2 = Price - bbN * bbStDevValues;
bbLower2 = Price + bbN * bbStDevValues;
IsBBSqueeze = bbUpper <= kUpper AND bbLower >= kLower;
Proportion = ((kUpper - kLower) / (bbUpper - bbLower)) ;
Proportion2 = ((kUpper2 - kLower2) / (bbUpper2 - bbLower2)) ;
BBBreakout = Cross(1,Proportion) AND C>MA(C,20) AND C>=Ref(bbUpper,-1);
BBBreakoff = Cross(1,Proportion2) AND C<MA(C,20) AND C<=Ref(bbLower,-1);
BBBreakout2 = Cross(1,Proportion); 

Periods = Param("BBPeriods", 20, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Màu", colorCustom1 );
Style = ParamStyle("Kieu");
bbtop=BBandTop( C, Periods, Width ) ;
bbbot=BBandBot( C, Periods, Width );
Plot(bbtop, "", color, style ); 
Plot(bbbot , "", color, style );
sqeezcolor=ColorRGB(194,220,218);
PlotOHLC( bbtop,bbtop, bbbot,bbbot, "",IIf(IsBBSqueeze,colorCustom1,colorDarkGrey), styleCloud|styleNoRescale,  Null, Null, Null, -1 );
Buy = BBBreakout;
Sell = BBBreakoff;
PlotShapes( shapeUpArrow * BBBreakout, colorBlue, 0,Low);
PlotShapes( shapedownArrow * BBBreakoff, colorBlue, 0,Low);
AlertIF( Buy, "SOUND C:\\D-AmiBroker\\music\\hoa loa ken mua.wav", "Audio alert", 3 );
AlertIF( Sell, "SOUND C:\\D-AmiBroker\\music\\hoa loa ken ban.wav", "Audio alert", 4 );
//% gia
Chg = ROC( C, 1 );
ChgV = ROC( V, 1 );
AddColumn(C, "Gia", 1.2, IIf(Chg >= 0, colorGreen, colorRed),-1);
AddColumn(V, "Khoi Luong", 1, IIf(chgv>= 0, colorGreen, colorRed),-1);
AddColumn(ChgV, "% KL", 1, IIf(ChgV >= 0, colorGreen, colorRed),-1);
AddColumn(Chg, "% Gia", 1.2, IIf(Chg >= 0, colorGreen, colorRed),-1); 
//end %gia
TextList = "KHONG\nCO";
AddMultiTextColumn(BBBreakout, TextList, "BREAKOUT", 1.2,IIf(BBBreakout, colorGreen, colorRed),colorWhite,-1);
AddMultiTextColumn(BBBreakout2, TextList, "SIDEWAY TICH LUY" , 1.2,IIf(BBBreakout2, colorGreen, colorRed),colorWhite,-1);
AddMultiTextColumn(BBBreakoff, TextList, "BREAKDOWN", 1.2,IIf(BBBreakoff, colorGreen, colorRed),colorWhite,-1);
Filter = BBBreakout OR BBBreakoff OR BBBreakout2;
_SECTION_END();

@Huynq99, this is a bit of a strange request!

Since the formula, on the most recent version of Amibroker, apparently runs without any errors whether applied to a Chart, in Exploration, or Backetst, it is unclear what is the "error" for you.

Maybe you mean that the program doesn't do what you want to obtain.
In this case, please explain better what is wrong concerning what you expect.

I'm also new to using the latest update of Amibroker. I ran the program to display a chart with the Cup and Handle pattern, but it didn't show any error messages and displayed the following on the screen.
I also don't know why it's failing at line 60 . Please help me check error on Amibroker 6.49.1 .
Very happy your help.

I think that this kind of issues should be directly reported to @Tomasz, so he can evaluate the cause and handle them in future releases.

@beppe Thanks you very much.

@Tomasz : Dear Tomasz!
Coud you please debug help me this error? Thks for your help.

Please press "Copy to Clip" button and paste the TEXT, not image. (or better yet send it to support)

When sending to support don't forget to INCLUDE THE FORMULA. Without formula report is pretty much useless.

By the way I have tried your code posted on top and it WORKS JUST FINE, without errors, exactly as @beppe wrote.

Without having the entire report (not screenshot) is is not possible to tell, but most likely the problem is outside of AmiBroker - you might have run out of RAM or you might have other problem with RAM (instability of system, bad memory)

AmiBroker version 6.49.1.6491
( 32-bit, cooltool.dll 6.49.1,  mfc42.dll 6.6.8063,  msvcrt.dll 7.0.22621 )

Microsoft Windows 10 version 10.0 (Build 22631) WOW64
Service Pack 0.0, Common Controls: 6.16

Unhandled exception
Type:	CSysException
Code:	c0000005
Description:	ACCESS VIOLATION
Address:	0043974A

AddColumn(Chg, "% Gia", 1.2, IIf(Chg >= 0, colorGreen, colorRed),-1);  
//end %gia 
TextList = "KHONG\nCO"; 
AddMultiTextColumn(BBBreakout
----------------------------^
File: 'Formulas\Drag-drop\3. HOA LOA KEN - BREAKOUT - TICH LUY 4.afl', Ln: 60, Col: 29
Error 47.
Structured Exception occurred during AFL formula execution at address: 0043974A, code: C0000005
Detailed exception information:
Broker.exe caused an EXCEPTION_ACCESS_VIOLATION in module Broker.exe at 0023:0043974A

Call Stack:
0023:0043974A Broker.exe
0023:0043D0D3 Broker.exe
0023:00449CE9 Broker.exe
0023:004108CB Broker.exe
0023:00441C3E Broker.exe
0023:0043E147 Broker.exe
0023:0043DDD9 Broker.exe
0023:004394DD Broker.exe
0023:0042344B Broker.exe

CPU Registers:
EAX=00000000  EBX=0019EEB0  ECX=BAB1FACE  EDX=BAB1FACE  ESI=00000003
EDI=06665428  EBP=0042344B  ESP=0019E550  EIP=0AB8A8C4  FLG=00210282
CS=0023   DS=002B  SS=002B  ES=002B   FS=0053  GS=002B

Additional information:

Multi-threaded charts - ENABLED

Number of stock loaded: 8712
Currently selected stock: VNINDEX
Number of quotes (current stock): 5755

Workspace:
Data source = FIAN, Data local mode = 1, NumBars = 10000

Preferences:
Data source = (local), Data local mode = 1, NumBars = 1000

Command history:
3111 - Insert into new chart pane--Insert

Cache manager stats:
Number of list elements: 2
Number of map elements: 2
Hash table size: 16001

Memory status:
  MemoryLoad: 61 %
  TotalPhys:      4194303K  AvailPhys:      3181000K
  TotalPageFile:  4194303K  AvailPageFile:  4194303K
  TotalVirtual:   4194176K  AvailVirtual:   3793072K


Log:
Logging started 2024-04-11 20:03:38
    14.75 ms : Current working dir set to C:\Program Files (x86)\AmiBroker. Checking write access... (0.33 ms)
    15.08 ms : Checking write access (C:\Program Files (x86)\AmiBroker\wrtchk.txt, attrs = 20) (0.10 ms)
    15.18 ms : Setting DPI awareness (0.03 ms)
    15.21 ms : Launching splash screen (2.18 ms)
    17.38 ms : Waiting for splash screen (8.36 ms)
    25.74 ms : Waiting for splash screen (15.71 ms)
    41.45 ms : Loading Common controls (0.10 ms)
    41.55 ms : Alloc other stuff (21.21 ms)
    62.76 ms : Loading amisci.dll (42.42 ms)
   105.18 ms : Setting up SEH translator (21.81 ms)
   126.99 ms : Initializing OLE (0.05 ms)
   127.04 ms : Initializing RichEdit (2.11 ms)
   129.16 ms : Loading persistent variables (4.32 ms)
   133.48 ms : Loading MRU lists (7.17 ms)
   140.65 ms : Loading commisison table (0.06 ms)
   140.71 ms : Loading preferences (7.39 ms)
   148.10 ms : Initializing display settings (0.37 ms)
   148.47 ms : Loading old groups and markets (4.98 ms)
   153.45 ms : Loading GICS and ICB (14.89 ms)
   168.34 ms : Loading plugins (0.26 ms)
   168.61 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\Candle.dll'  (14.48 ms)
   183.09 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\CMAE.dll'  (20.00 ms)
   203.09 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\CQG.dll'  (19.93 ms)
   223.03 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\DDE.dll'  (55.52 ms)
   278.55 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\eSignal.dll'  (125.32 ms)
   403.87 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\FireAnt.dll'  (41.08 ms)
   444.95 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\FT.dll' - failed. Error code: 126: The specified module could not be found. (19.52 ms)
   464.47 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\IB.dll'  (41.18 ms)
   505.65 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\IQFeed.dll'  (31.58 ms)
   537.23 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\JurikLib.dll'  (19.41 ms)
   556.65 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\kpami.dll'  (42.64 ms)
   599.28 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\MetaKit.dll'  (177.12 ms)
   776.40 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\MOCASample.dll'  (20.53 ms)
   796.93 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\MS.dll'  (27.86 ms)
   824.79 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\MT.dll'  (24.18 ms)
   848.97 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\myTrk.dll'  (32.76 ms)
   881.73 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\ODBC.dll'  (31.62 ms)
   913.35 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\ODBCA.dll'  (31.14 ms)
   944.50 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\PSOSample.dll'  (18.39 ms)
   962.89 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\QP2.dll' - failed. Error code: 126: The specified module could not be found. (29.51 ms)
   992.40 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\QT.dll'  (23.73 ms)
  1016.13 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\TC2K.dll' - failed. Error code: 1114: A dynamic link library (DLL) initialization routine failed. (24.25 ms)
  1040.38 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\TC2KFunds.dll' - failed. Error code: 1114: A dynamic link library (DLL) initialization routine failed. (25.61 ms)
  1065.99 ms :  Loading 'C:\Program Files (x86)\AmiBroker\Plugins\Tribes.dll'  (18.88 ms)
  1084.87 ms :  Checking for any new non-certified plugins (0.18 ms)
  1085.05 ms :  Done. (0.03 ms)
  1085.08 ms : Loading AT interfaces (0.11 ms)
  1085.19 ms : Loading AFL function table (1.99 ms)
  1087.18 ms : Init chart infos (1.13 ms)
  1088.31 ms : Loading parameters (11.09 ms)
  1099.40 ms : Loading chart infos (5.24 ms)
  1104.65 ms : Loading custom tools (6.75 ms)
  1111.40 ms : Allocating lists (0.24 ms)
  1111.63 ms : Loading layers and alerts (10.73 ms)
  1122.36 ms : Loading miscellaneous data (0.09 ms)
  1122.45 ms : Adding MDI templates (3.82 ms)
  1126.28 ms : Register OLE server (4.59 ms)
  1130.87 ms : Creating main frame object (25.42 ms)
  1156.29 ms : Loading main frame (347.77 ms)
  1504.06 ms : Parsing command line (0.04 ms)
  1504.09 ms : Checking Broker.Document object registration (0.15 ms)
  1504.24 ms : Setting browser emulation to IE11 (0.10 ms)
  1504.35 ms : Dispatch commands via ProcessShellCommand (0.11 ms)
  1504.46 ms : Showing main frame window (314.60 ms)
  1819.06 ms : Setting up accelerators (0.17 ms)
  1819.23 ms : Loading database (LoadMarketData) (678.70 ms)
  2497.93 ms : Setting active symbol (140.62 ms)
  2638.55 ms : Opening default chart (189.58 ms)
  2828.13 ms : Loading default workspace/layout (143.39 ms)
  2971.52 ms : Closing startup splash screen (async in 1 second) (6.63 ms)
  2978.15 ms : Starting up schedule (5.63 ms)
  2983.79 ms : *InitInstance finished

You are using unsupported, third-party data plugin "FIAN" (FireAnt.dll) as well as other unsupported/unknown plugins: kpami.dll, MetaKit.dll
First step is to remove 3rd party plugins from AmiBroker. Third party plugins are not tested by us and can cause all kind of bizarre errors.

Also check your computer for hardware stability using Prime95 torture test.

1 Like

@Tomasz
I have got commend waiting approval.
Thks a lot