AmiBroker 6.40.2 released

A new release candidate version (6.40.2) of AmiBroker is available now.


32-bit version:
(10 406 776 bytes)

64-bit version:
(11 036 104 bytes)


DevLog announcement: -to be posted later-

For the details see ReadMe.html and ReleaseNotes.html inside AmiBroker folder.


This version is a free upgrade only for users who registered AmiBroker after December 30, 2019 . Users who registered earlier, would need to purchase license upgrade. To find out the version you currently have use Account Information page at

What's new in AmiBroker 6.40


Version 6.40 brings lots of new functionality especially with regards to the formula language and performance . There are hundreds of new features and changes to existing functionality as compared to version 6.30, listed in detail in "Release Notes" document in AmiBroker directory. Below is just a short list of few of them:

  • QuickGFX - brand new chart rendering engine delivering upto 100x performance boost as compared to GDI rendering. GDI rendering speed also improved upto 2x.

    In-house developed QuickGFX direct rendering technology completely bypasses Windows GDI and offers amazing 10x-100x performance gain as compared to GDI renderingTo enable QuickGFX experimental tech go to Tools->Preferences, "Miscellaneous" tab, click "Experimental: Use QuickGFX render" and press "Apply" or "OK"
    You can see when it is enabled, chart timing footnote (when enabled) will say "QuickGFX render" instead of "GDI render"This is PROFESSIONAL edition feature only. Users of Standard version would need to purchase upgrade in order to use this feature.

  • Automatic Analysis improvements

    • Easy Sequencing of multiple Analysis actions via #pragma sequence(scan,exploration) and new "Run Sequence" button without need to write batches. Allows for example single click two-step analysis runs creating composites or static variables in first step and using them in second step
    • Backtester - added "Max. position value" option in the settings allowing to specify maximum dollar value of position. Zero (0) means no maximum. Positions larger will be shinked (if shrinking is enabled) or won't be entered at all (if shrinking is disabled)
    • huge speedups in running large explorations, dark theme and 5x speed up for rendering huge list views like (as compared to 6.31)
  • AmiBroker Formula Language new functions / features

    • FindIndex( array, value, start_from = 0, dir = 1 ) - find index of array item matching specified value
    • BarsSinceCompare( past, comparison, current ) - for every bar, compare past array values with current bar value and return the number of bars since last time comparision was true
    • InternetSetHeaders( "headers" ) - set custom HTTP headers for subsequent web requests
    • InternetSetOption( option, value ) - set HTTP option for internet session
    • InternetPostRequest(''http://url_to_your_web_resource'', data, flags = 0) - send HTTP Post request to Internet web resource (URL)
    • MxCopy() - in-place copy of rectangular blocks from one matrix to the other (copy portions of one matrix to the other matrix)
    • _exit() - gracefully ends AFL execution at the point of the call
    • InternetGetStatusCode() - returns HTTP status code of last InternetOpenURL or InternetPostRequest call
    • Chr( code ) returns string representing single character of given ascii code
    • GetObject( path, class ) providing functionality equivalent to JScript GetObject and VBScript GetObject
    • GuiSendKeyEvents("ED") - register given characters to be sent as Gui event when keyboard key is pressed. GuiGetEvent will return code == notifyKeyDown and id of given character, for example id == 'D' for D letter
    • inverf(x) - inverse of erf function
    • erf(x) - computes Error function Error function - Wikipedia
    • SafeDivide( x, y, valueifzerodiv )- safe division that handles division by zero using special handling (replace result with user-defined value)
    • new Javascript engine (Chakra) featuring native JSON support (EnableScript("chakra"))
  • AmiBroker Formula Language improvements, enhancements and fixes

    • exponentation operator is made 50-100x faster in cases of small integer exponents of 2, 3, 4 and 5
    • GuiSetText() function avoids sending change notifications to prevent update loops
    • ADX function vectorized (2x faster than before)
    • added extra parameter for Error() function to stop execution
    • internal function signatures changed to allow flexible ordering of arguments regardless of their type and varargs with less overhead
    • GfxDrawImage with PNG images exclusive file lock removed
    • parser warns if empty body is used in 'for' or 'while' statements
    • support for gzip and deflate compression in Internet functions
    • plugin interface backward compatibility with changing function signatures
    • more runtime checks to prevent user errors and other fixes
  • Batch window new features / improvements

    • Clipboard Cut/Copy/Paste implemented in batch editor
    • Edit->Delete (from main menu) and Edit-Delete All implemented for completeness
    • list view uses virtual mode now (owner data)
    • added "add results to watchlist" action / WatchlistAddResults
    • added "clear watchlist" action / WatchlistClear
    • added "comment" action
    • added optional parameter to Data Import ASCII command to allow specify format definition file
    • added optional parameter to Execute and Wait command to specify current working directory for command
    • added optional parameter to Export to File / Export walk-forward to file to specify column separator in CSV files
      -optional parameter defines the column SEPARATOR used for export. Only single character is used. When it is not supplied, comma is used.
  • AFL editor enhancements

    • call tips (parameter information tooltips) now provide extra description about the function and its parameters (as of v6.39 only 20 functions have this extra info)
    • debugging session is automatically terminated with appropriate notice when user attempts to edit the code during debugging (this saves mouse clicks that were needed to stop debug session in order to edit)
    • previously when no text was selected and Prettify Code was choosen, the message box caused main frame to get focus instead of focus staying in AFL frame. Fixed
    • when an runtime error is detected debugging session the message bar shows now number of detected errors (as it did previously during normal "verify"
    • when dark mode list views are used watch window default text color was black making it hardly visible, changed to white
  • User Interface new features and improvements:

    • Dark theme for all owner-draw list views (NOT in dialogs) now feature customizable theme (currently available "system (light) theme" and "black theme") - go to Tools->Customize, "Appearance" tab, "Dark mode for listviews" checkbox
    • 5x speed up for rendering huge list views (bypassing Windows rendering)
    • Preferences: added Text Tool font setting independent from Axis font (Preferences->Miscellaneous page)
    • Charts: improved text tool with per-study selectable font size
    • Parameter names are not truncated in HighDPI screens
  • Database improvements

    • new 8-digit ICB structure implemented: Industry Classification Benchmark (ICB) | FTSE Russell
    • Database Purify is 10x faster
    • OLE: added Stock.Quotations.Adjust function to perform adjustments programmatically OLE: added Stock.Quotations.Adjust() function. long Adjust(BSTR pszFieldList, float fMultiplier, float fOffset, DATE dDateTime, boolean bBefore)

CHANGES FOR VERSION 6.40.2 (as compared to 6.40.0)

  1. 32-bit/Charts: x87 assembly code used for faster conversion from float to int. This gives +20% performance improvement in both GDI and QuickGFX rendering modes
  2. 64-bit: the size of internal exit signal structure increased to allow backtest with more than 1 million symbols (at the cost of increased RAM usage). 32-bit version still uses smaller structure and 1 million symbol limit
  3. AFL Editor: Defunct Print menu option removed from context (right-click) menu. Working Print option is available in File->Print menu
  4. AFL: _SECTION_BEGIN() - section name is checked against not allowed control characters
  5. AFL: ADX/PDI/MDI protected against division by zero when data are completely flat (H == L == C for long periods of time)
  6. AFL: array version of ColorHSB function is 50% faster now
  7. AFL: new function BarsSinceCompare( past, comparison, current ) - for every bar, compare past array values with current bar value and return the number of bars since last time comparision was true
  8. AFL: New warning 511 for incorrect usage of IIF function: "Assignment within IIF function arguments. Use IIF() return value instead"
  9. AFL: Param*() functions check if user passed non-printable/control characters, that are forbidden in parameter names and display appropriate error message
  10. AFL: regression new Error 72 was incorrectly generated when amount was zero but mode was set to Disable (like in file). The combination of zero amount and disable is of course valid and error is no longer produced in such case.
  11. AFL: Status("baseinterval") - new field "baseinterval" returns database base time interval setting in seconds
  12. AFL: Warning 501 (assignment within conditional) is silenced if assignment is made to the variable that wasn't intitialized before (i.e. it is first assignment of given variable ever in code)
  13. AFL: Warning 512 added to detect overusage of Foreign/SeForeign calls
    Analysis report charts: regression: when QuickGFX was enabled, report charts could cause exception. Fixed.
  14. ASCII import: combination of $HYBRID 1 without "autoadd" mode produces an error on non-existing symbols now.
  15. Charts: 40% speedup in determination of auto-scale min/max (signficantly affects chart rendering performance for very large number of bars >500K)
  16. Charts: Bar-to-XPixel coordinate conversions speeded up 3x by using assembly in 32-bit and _div64/__emul intrinsics in 64-bit versions
  17. Charts: GDI rendering of cloud style charts is now 2x faster
  18. Charts: QuickGFX rendering of cloud style charts is now 100x faster
  19. Charts: when QuickGFX was enabled multi-color title text was slightly truncated at the color boundaries. Fixed.
  20. DB: when user renames the symbol corresponding Note text file name is renamed accordingly now
  21. Fixed regression introduced in 6.39 when the very last value in MA was non-Null even if there was not enough data
  22. New Analysis window: #pragma sequence(scan,backtest) - and new "Run Sequence" button to run same formula with same settings several times in sequence using different modes
  23. OLE: added Stock.Quotations.Adjust() function. long Adjust(BSTR pszFieldList, float fMultiplier, float fOffset, DATE dDateTime, boolean bBefore)
  24. QuickGFX: Line width > 1 implemented
  25. QuickGFX: New lines in Title variables caused double spacing. Fixed
  26. QuickGFX: styleHistogram was invisible for negative values. Fixed
  27. UI: Param window, names of parameters are not tructated on HighDPI screens anymore
  28. When worker thread attempted to read string from resources sometimes resource handle was set incorrectly, this caused COleException / unknown error. Fixed by replacing faulty MS CString::LoadString implementation.

For list of changes in the previous version 6.40.0 see: AmiBroker 6.40.0 RC released


Really appreciate the changes - especially the GFX improvements.


Thank you. Excellent release.


I remember when "Tom terrific" use to reference the American football "G.O.A.T", quarterback Tom Brady. Well he definitely has some competition. Thank you Tomasz!

Happy, healthy and prosperous new year to everyone.


New update with some great features to welcome the new year. Thanks Tomasz, and happy new year!

1 Like

Thanks you and Happy new year!

There is one (important) change that is not mentioned in the "CHANGES" log.

The TickerBar has been completely changed to allow handling databases with millions of symbols, see this forum thread: Import wizard for huge files (5 million symbols,2.5GB+ into 230GB database) - #30 by Tomasz

As discussed in that thread:

ListBox is pretty old component in Windows (Microsoft did it in '90s) and it was never designed to handle more than 32K elements at the time they wrote it. While in modern Windows you can add more elements to it, it is pathetically slow and it takes few minutes to fill 5 million elements. Filling that listbox occurs when you load database or when you change symbol names or full names. Therefore this is yet another component of Windows that must be replaced by custom code to be able to handle millions of items quickly. So "rewriting Windows" saga continues.
Once I replace Windows component by custom code it should be able to handle millions of symbols within fraction of second (I hope).

So this was another part of Windows OS that is pretty much useless for large number of items and I had to reimplement that too.

The trouble was I started working on that but got distracted with other stuff and that work was only partially done and did not get into "CHANGES" log (because it wasn't complete).

So in 6.40.2 ticker box is already super fast and handles millions of items very quickly, but some of functionality is missing (namely optional "full name" display and quick auto-complete / search, i.e. ability to type partial symbol name + ENTER would auto-complete if symbol with matching prefix is found)

This functionality re-implemented is coming in 6.40.3.


Re-writing windows sounds tedious, but if anyone were prime for the job I think you'd be the one @Tomasz :rofl:

I can't imagine how long it must take to download data from 5 million symbols!

it took 12 minutes ))

1 Like

Happy New Year to you too Tomasz! What a way to start the new year - BANG!! :fireworks: Thanks for such a great product!

Faster than I would have thought! Who's your data provider?

Faster than I would have thought! Who's your data provider?

I've tested some strategies with weekly options. So, I downloaded the intraday historical data for weekly options since 2014 till now:
670 underlying symbols * 7 years * 12 months * 4 weeks * (10 call strikes + 10 put strikes) = 5 mln symbols

1 Like

Thank you very much for this great release.
QuickGfx is fantastic, I can't stop wasting all cycles saved by adding superfluous bells & whistles :joy:
I also like very much BarsSinceCompare() which makes some scripts much cleaner !
The Chakra engine is a great improvement too but I'm a bit concerned as it's not supported anymore by Microsoft. I guess it's easier to integrate than V8 though.

Happy new year & Best wishes !

i would like to pay the new version

Upgrades are available for purchase here Ordering Page

1 Like

You may considering pinning the post about Ticker Box,
I was wondering why auto-complete isn't working suddenly and spent time reading here when i found this post.
It will help others and maybe save you time on emails :slight_smile:
The thread is pinned but this post is like #10

1 Like

I am afraid Discourse does not allow pinning individual posts, but I highlighted post #10

By the way: 6.40.3 will be released January 15.


This Might not be the right forum but i thought it was worth sharing, This release has made a huge improvement to my used system resources. well done! thanks


Do you mean in terms of CPU resources or other? Please share some more details.