AmiBroker 5.89.0 BETA Read Me
October 31, 2014 14:05
THIS IS A BETA VERSION OF THE SOFTWARE. EXPECT
BUGS !!!
Backup your data files and entire AmiBroker folder
first!
INSTALLATION INSTRUCTIONS
ATTENTION: This version is free only for users who registered after
October 31,
2012.
IMPORTANT: This archive is update-only. You have to install full version
5.80 first.
Just run the installer and follow the instructions.
Then run AmiBroker. You should see "AmiBroker 5.89.0 BETA" written
in the About box.
See CHANGE LOG below for detailed list of changes. Note that only changes
that affect end-user directly are listed here. Internal code changes/refactoring
is usually not mentioned.
CHANGE LOG
CHANGES FOR VERSION 5.89.0 (as compared to 5.88.0)
- AFL: Performance of variable-length Sum() improved significantly in some
common scenarios. Accurracy improved too.
- AFL: Sort displayed an error message
if first == last even though this case
is perfectly fine. Fixed (no error and no sorting of single-element array)
- AFL:
Sort() with indexmode = True could cause immediate app exit in 64-bit version
only. Fixed.
- AFL: when negative 'range' was passed to variable-length version
of Sum() an application exited immediately. Fixed.
- Charts: Left/right extended
Trend lines and Rays now use user-definable Extension Factor (new field in
Study properties) instead of always infinite extent.
Ext. Factor equal to ZERO means INFINITE, other values 0.1 ... 26 define
how far
to the left/right line is extended
- Charts: max zoom achievable via View->Zoom
Out is increased to 5 million bars, also Pref/Charting/Default zoom limit
set to 5 million. Note that it
is still possible to zoom to "all" quotes regardless of number
of bars using View->Zoom->All
- Debug: Crash recovery window now requires to
enter steps required to reproduce problem. Without knowing what you did before
it is very difficult to find
out the reason and fix the problem.
- Debug: Turned off remove frame pointers
optimization in 32-bit builds for better stack traces
- New Analysis: Exploration:
default column width is increased automatically to fit %6.2f number when
there is a free space available in the right margin
- New Analysis: Optimization:
when user-selected "Optimization target" can
not be found in the backtest results an error 711 is displayed and optimization
process is stopped
- New Analysis: trying to bring up "Parameters" window
when currently selected symbol had no quotes resulted in access violation.
Fixed.
- New Analysis: Walk forward tab - when you click on result list Begin/End
column headers - these columns are now sorted by date instead of alphabetically.
CHANGES FOR VERSION 5.88.0 (as compared to 5.87.0)
- AFL: new function NullCount( array, mode = 1 ) - counts the number of consecutive
nulls at the beginning of the array (mode = 1), at the end of the array (mode=2),
from both ends (mode=3) and all nulls in the array (including non-consecutive)
(mode=0)
x = MA( C, 20 );
printf("Empty values at
the beginning = " + NullCount( x ) );
- AFL: Sort() now has additional "indexmode". If indexmode
is turned on, Sort() function returns array of indexes to the sorted values
instead
of values themselves. So if first returned value is 2923 it means that input
array[
2923 ] is the smallest element
Filter = 1; AddColumn( BarIndex(), "Bar
Index", 1.0 );
AddColumn( Close, "Close" );
AddColumn( Sort( Close ), "Sorted
Close" );
AddColumn( Sort( Close, 0,
-1, True ), "Index
of sorted item", 1.0 );
- Charts: line drawings now have user definable
line width in pixels (new "Line
width" field in Study Properties dialog). In addition to that "Thick
line" box makes line twice as wide (so actual width of thick line is
2 * lineWidth instead of adding 1 pixel to width)
- Charts: when formula causes
an exception and Preferences are set NOT to catch exceptions within indicator,
then further execution of formula that caused
exception is blocked until Bug recovery window is dismissed (to prevent stacking
multiple bug recovery windows)
- Debug: 64-bit version now implements invalid
parameter handler for catching wrong C runtime calls
- Debug: 64-bit version:
Crash recovery window now includes call stack to allow better debugging of
64-bit app (previously only available in 32-bit)
- Debug: when AFL engine can
not allocate memory for variable a proper message is displayed instead of
plain crash
- Debug: when program can not allocate memory for static variable
you will get actual message "Out of memory during creation of static
variable");
- New Analysis: program checks From-To dates and if From > To
it displays error 710 instead of starting analysis
- New Analysis: QuickAFL
finally implemented. To turn it on go to Settings and check "Use QuickAFL" box.
Gives very significant speed-ups (>2x)
when range is smaller than "All quotes"
- Prefs/Backtest: Number of
user-definable currencies in Tools->Preferences
increased from 20 to 100.
- Prefs/Charting: "Default zoom (number of bars
in a chart)" can
now be greater than 32767 (previous limit). Now it can be in range from 10
to 10
000 000.
- UI: when free virtual memory drops below 200 MB a popup is displayed
in the status area
CHANGES FOR VERSION 5.87.0 (as compared to 5.86.0)
- AFL Editor: in-line error reporting use bold font to highlight identifiers
in the error messages for better readability
- AFL: GetOption can now read BuyDelay/SellDelay/ShortDelay/CoverDelay
which makes it easier to write like this:
InLong = Ref( Buy, GetOption("BuyDelay") ); // make sure we delay
the signal in sync with settings
ApplyStop( stopTypeLoss, stopModePercent, IIF( InLong, 10, 15 ), True ); //
10% stop for long 15% stop for short
- AFL: new function: Reverse( array,
first = 0, last = -1 ) - returns a new array with the order of the elements
in specified range reversed
- AFL: new function: Sort( array, first = 0, last
= -1 ) - sort a numerical array in ascending order starting from 'first'
element ending at 'last' element.
If 'last' is not specified or negative then AmiBroker will use BarCount - 1
Filter = 1;
AddColumn( BarIndex(), "BI");
AddColumn( Close, "Close");
AddColumn( Sort( Close ), "Sorted");
AddColumn( Reverse( BarIndex()
), "Reversed BI" );
- AFL:
new function: StrSort( "item,list,to,be,sorted", caseSensitive
= True, separator = ',' ) - perform sorting of comma-separated string (case
sensitive/insensitive, separator definable!)
- AFL: new function: StrTrim( "string", "targets",
side = 3 ) - a function to trim extra characters (specified in "targets")
from either left (1), right(2) or both(3) sides of the string. If "targets" parameter
is an empty string, then function trims whitespaces (i.e. space, tab, newline)
Here is example of StrSort/StrTrim in per-symbol profit / loss custom metrics
code. Compared to Knowledge Base article it outputs SORTED list of symbols.
function ProcessTrade( trade )
{
global tradedSymbols;
symbol = trade.Symbol;
//
if( ! StrFind(
tradedSymbols, "," + symbol + "," )
)
{
tradedSymbols += symbol + ",";
}
//
// HINT: you may replace it with GetPercentProfit
if you wish
profit = trade.GetProfit();
//
if( trade.IsLong() )
{
varname = "long_" + symbol;
VarSet( varname, Nz( VarGet(
varname ) ) + profit );
}
else
{
varname = "short_" + symbol;
VarSet( varname, Nz( VarGet(
varname ) ) + profit );
}
}
//
SetCustomBacktestProc( "" );
//
/* Now custom-backtest procedure follows */
//
if ( Status( "action" )
== actionPortfolio )
{
bo = GetBacktesterObject();
//
bo.Backtest(); // run default
backtest procedure
//
tradedSymbols = ",";
//
//iterate through closed
trades
for ( trade
= bo.GetFirstTrade( ); trade; trade = bo.GetNextTrade( ) )
{
ProcessTrade( trade );
}
//
//iterate through open
positions
for ( trade
= bo.GetFirstOpenPos( ); trade; trade = bo.GetNextOpenPos( ) )
{
ProcessTrade( trade );
}
//
tradedSymbols = StrTrim(
tradedSymbols, "," );
tradedSymbols = StrSort( tradedSymbols );
//iterate through the list of traded symbols and generate
custom metrics
for ( i = 0;
( sym = StrExtract( tradedSymbols, i ) ) != "";
i++ )
{
longprofit = VarGet( "long_" +
sym );
shortprofit = VarGet( "short_" +
sym );
allprofit = Nz( longprofit ) + Nz(
shortprofit );
// metric uses 2 decimal points and
//
3 (calculate sum) as a "combine method" for walk forward out-of-sample
bo.AddCustomMetric( "Profit
for " + sym, allprofit, longprofit, shortprofit, 2, 3 );
}
}
//
SetOption( "MaxOpenPositions", 10 );
//
Buy = Cross( MACD(), Signal()
);
Sell = Cross( Signal(), MACD()
);
Short = Sell;
Cover = Buy;
SetPositionSize( 10, spsPercentOfEquity )
;
- AFL:
StrExtract has now extra parameter allowing to specify separator character,
example StrExtract("This;Is;Semicolon;Separated", 3, ';' );
- AFL:
StrMid( "string", start, count ) now allows to
skip "count" parameter.
If you skip count, then a substring starting from 'start' to the end of the
string will be returned.
- Charts: added ability to control number of decimals
in chart value labes via GraphLabelDecimals variable (example, adding GraphLabelDecimals =
2; to the
formula would give you value lables with 2 decimal places
- Removed old-style
Graph3*, Graph4*, Graph5*, Graph6*, Column3, 4, 5, 6 identifiers from auto-complete
lists (only 0..2 left)
- Report Explorer: Edit->Copy now copies selection
only (not entire table)
CHANGES FOR VERSION 5.86.0 (as compared to 5.85.0)
- AFL Editor: repeat replace + wrap around restarts only once and if no further
matches/replaces are found it displays "no more matching texts" instead
of restarting again.
- AFL Editor: when user closed Find&Replace dialog
and then pressed F3 (find next) a couple of times to pass thru the end of
document a crash could
occur.
Fixed.
- Analysis: HTML report generator - settings page used </TD> tags
to close some <TH> tags which is formally incorrect, even if it works.
Fixed.
- Charts: Extreme descenders in text could be truncated (by one pixel)
in multiple line Title strings. Fixed.
- HTMLView - Backtest report viewer
- added Edit/Copy, Edit/Select All and Edit/Copy TABLE. The last command
transforms HTML tables into CSV format
and copies it
into clipboard so tables can be pasted easily to Excel. Also it divides
Entry/Exit columns into separate Entry/exit date/price columns
- Parameter
window: mouse wheel scroll is now supported
- Realtime Quote window: added Bid/Ask
trend - a graphical indicator showing the direction of 10 most recent changes
in real-time bid/ask prices
The right-most box is most recent and as new bid/ask quotes arrive they are
shifted to the left side. Color coding is as follows:
Dark green: bid > previous bid OR ask > previous ask
Bright green: bid > previous bid AND ask > previous ask
Dark red: bid < previous bid OR ask < previous ask
Bright red: bid < previous bid AND ask < previous ask
Red / Green box: ask < previous ask AND bid > previous bid
Green / Red box: ask > previous ask AND bid < previous bid
If bid/ask prices don't change there is no new box.
NOTE: This column works only if there are real-time quotes streaming (markets
are open)
- Realtime Quote window: Sorting by Full name column did no work. Fixed
- Report Explorer: Column layout (order and sizes) is now
saved and restored between runs
- Report Explorer: Loading and refresh performance
significantly improved (5x) using owner draw/ virtual mode
- Report Explorer:
Multi-column sorting implemented
- Report Explorer: Numeric columns are now
right aligned for better readability
- Report Explorer: visuals significantly
improved (list uses modern style, grid lines, immediate column resizing,
double
buffering
for no flicker,
thousand separators, negative values are displayed in dark
red, HighDPI aware, changed
toolbar)
- Snippet properties window now includes formula field for
quick reference (no highlighting here - it is by design)
CHANGES FOR VERSION 5.85.0 (as compared to 5.84.0)
- AFL Editor: backtest* mode constants added to auto-complete list
- AFL Editor:
now Code snippets are available in auto complete list (type @ plus first
letter of snippet key trigger), and even without auto complete activated
@keytrigger is replaced by snippet text
- AFL: added support for single-character
literals, so you don't need to use Asc() funciton.
Buy = Cross( MACD(), Signal() );
Sell = Cross( Signal(), MACD() );
Filter = Buy OR Sell;
AddColumn( IIf( Buy, 'B', 'S' ), "Signal", formatChar );
- AFL: adding/removing symbols
to/from watch list via CategoryAddSymbol/CategoryRemoveSymbol wasn't thread
safe. Fixed.
- AFL: AmiBroker now checks number passed to SetOption("MaxOpenPosition",
x ) and SetOption("WorstRankHeld",x ) and trims down the request
to number of symbols in database to prevent running out of memory when user
specifies some absurdly high values,
- AFL: new function SendEmail( "subject", "message",
ShowUI = False )
A direct version of functionality already provided by AlertIF. This function
sends e-mail unconditionally and it is easier to use if you don't need state
logic provided by AlertIf.
Note that "From" and "To" addresses as well as SMTP email
configuration should be done in Tools->Preferences, "Alerts" page.
Without configuring E-mail settings first this function will not work.
E-mails are sent asynchronously (so function returns BEFORE e-mail is actually
sent, sending occurs in the background)
ShowUI parameter decides whenever user interface of e-mailer program is
shown after sending e-mail or not.
- AFL: SetOption("MarginRequirement", x ) checks
if x is in the range 1..100 and displays an error if not.
- Backtest: backtestRegular
now keeps detailed info on sequencing of signals within single bar to avoid
problems with premature exit of just opened trade
when same bar exits were allowed and previous trade was not open due to insuffcient
funds leaving an unmatched exit signal.
In case when an exit signal that really belongs to previous trade was found
on the bar when next trade was open AmiBroker would display the following entry
in the detailed report log:
<
Symbol> Exit/Entry/Scaling ignored because signal predates already processed
event.
FWIW: The issue did not affect other backtest modes.
- Code Snippets: added "Properties" button
to the toolbar that allows editing name/description/key trigger without re-inserting
snippet
- Code Snippets: New snippet/Properties dialog is now resizable
- UI: changed
cursor shape in all tree views from "hand" to normal
arrow
- UI: Code snippet window is now also available when AFL editor is in
MDI mode (use Window->Code Snippet menu when AFL editor is open)
- UI: Interpretation
window: Ctrl+C (clipboard copy) did not copy the interpretation text in
5.8x. Fixed.
CHANGES FOR VERSION 5.84.0 (as compared to 5.83.0)
- AFL Editor: Idle-time Info tips were positioned incorrectly in 5.83. Fixed.
- AFL
Editor: Text of inserted snippet is selected so one can easily see what was
inserted and delete it if was a mistake.
- AFL: added Error 57. Invalid quotation
mark (when user uses curly quotation marks instead of straight quotation
marks " to type a string literal)
- OLE: Document object has new property
Interval (integer, read/write) - selected Interval in seconds (tick/range/volume
intervals are represented by negative
values)
- Report Charts: now it is possible to output HTML instead of graphics
in report chart formulas using AFL: EnableTextOutput( 3 ) - HTML output
to backtest
report
- Report Charts: rewritten 3. Profit Table.afl using HTML embedding
features auto-scalable layout (so it enlarges when numbers are bigger),
bold summary
columns, negative values in red, boundary date changed to last day
of year/month
- UI: added Code Snippets window - allows inserting/deleting/saving
selected parts of the formula as snippets. Also implemented is convenient
drag-drop
of snippet to the formula edit window
- UI: Further display improvements
of Parameter window for high-DPI displays (ParamList bullet point is bigger
and positioned better,
Slider is
resized when resizing param window, etc, etc)
- UI: On non-standard
DPI displays Parameter window could show some visual artifacts when scrolling.
Fixed.
CHANGES FOR VERSION 5.83.0 (as compared to 5.82.1)
- New Analysis: Watch list 0 was used automatically (without opening WL selection
dialog) when new watch list is created between scan and RMB click->Add
results. Fixed.
- UI: Parameter window look and feel improved. Item height is
increased and slider thumb made wider for easier use on small size/high DPI
screens
- Commentary: attempt to display commentary on symbol without any quotes
could cause access violation. Fixed.
- AFL Editor: Verify formula run on symbol
without any quotes could cause access violation. Fixed (proper error message
is displayed).
- Analysis: Table header in the HTML report trade list is now
right aligned (to match number alignment) (affects newly generated reports
only)
- AFL editor: when syntax check is performed and errors are detected,
the editor is immediately scrolled to first error
- Analysis: Minimum value
for "Margin Requirement" is now 1 (1%)
- AFL: Since v5.65 RestorePriceArrays()
did nothing when there was no preceding SetForeign/TimeFrameSet. Now restores
data if user explicitely overwrote
OHLC arrays in the code preceding it.
- Analysis: Detailed Log message "Symbol
not entered bcause of insufficient funds" improved to display requested
position size in units such as shares/% of equity instead of just encoded
negative value
- AFL engine: brand new custom micro allocator speeds up AFL
execution of complex formulas with nested loops upto 3 times.
- Turned on LowFragmentationHeap
in number of places
- Code snippets: New line \n was truncated from "data
export" snippet.
Fixed.
- AFL Editor: parameter info tip does not disappear on pressing Backspace
key anymore.
- AFL Editor: Parameter info updates highlighted parameter when
moving cursor inside function's param list
- New Analysis: Less refreshes
of Info page provide some extra speed
- Analysis: fixed HoldMinBars check for scenario 3 with both buy and sell
generated on all bars and random scores.
CHANGES FOR VERSION 5.82.1 (as compared to 5.82.0)
- AFL Engine: fixes for stability issues in 5.81.0/5.82.0
- Filter dialog: a matching count wasn't updated on opening the dialog. Fixed.
- Bug
report window made a little bigger so at least crash address is seen when
someone sends screenshot instead of text
CHANGES FOR VERSION 5.82.0 (as compared to 5.81.0)
- UI: Interpretation and Commentary windows now support color text (via EncodeColor),
bold and italic styles (tags: <b></b> for bold, <i> </i> for
italic). Example:
printf("<b>Bold
text</b>\n");
printf("<i>Italic
text</i>\n");
printf("Now " + EncodeColor( colorRed )
+ "red text\n");
printf("and finally " + EncodeColor( colorGreen )
+ "green <b>AND bold <i>AND italic</i></b>\n");
printf(EncodeColor( colorBlack )
+ "going back to black");
- UI: Notepad, Interpretation and Commentary windows use default GUI
font instead of hard-coded Tahoma now
- AFL: functionality of PlotGrid() function
extended
PlotGrid( level, color = colorDefault, pattern = 1, width = 1, label = True
)
pattern - defines line pattern. Available grid patterns 1..10 as shown in
the Tools->Preferences, "Axes & Grids"
1-7 are single pixel patterns, 8 is regular windows dot pattern (PS_DOT)
, 9 is regular Windows dash pattern (PS_DASH), 10 is solid line
width - grid line width (in pixels). Note that due to Windows GDI limitations
only patterns 8 (PS_DOT), 9 (PS_DASH), 10 (PS_SOLID) are available in widths > 1
label - whenever to display value label or not
Use PlotGrid to display horizontal lines that are constant instead of using
Plot.
PlotGrid offers much better performance in this case.
So instead of
Plot( 50, "", colorRed, styleLine | styleThick );
use:
PlotGrid( 50, colorRed, 10, 2, False ); //
solid line 2 pixels thick, no label
- AFL Editor: added 4 new snippets under "Function" category
- UI:
Filter dialog now displays number of matching symbols in real-time as selections
are made
- AFL: CCI function speeded up by 50%
- Inserting indicator with Param() calls
into chart when currently selected symbol had no quotes caused exception.
Fixed.
- AFL: In 5.81.0 CategoryGetName returned nothing (void) instead of string
type when specified category did not exist. Fixed (empty string is returned
now)
- New Analysis: portfolio backtest processing was attempted even if there
was no symbols that matched "apply to" filter. Fixed (unnecesary
processing is skipped now).
- AFL engine: in v5.81 access violation could occur
when AFL array size was 0. Fixed.
CHANGES FOR VERSION 5.81.0 (as compared to 5.80.3)
- AFL Engine: custom memory allocator does not use Microsoft runtime lib
for reference tracking anymore. Result - complex formulas with lots of loops
and OLE (especially
low-level custom backtests) run upto 3 times faster in 32 bit and 4 times
faster in 64-bit
- AFL Editor: Parameter info tip significantly enhanced - now
it re-opens on typing each , (comma) and highlights current parameter to
be entered.
- UI:
Column setup dialog: added Mark All / Toggle All buttons
- AFL: GetFormulaPath()
function added - returns full formula file path
- AFL Editor: Smart reference
highlighting implemented (usage: mark a word and all references become
highlighted).
- AFL Editor: Find/Replace shows a message box when reached the
end of the file and offers restarting from the beginning if new "Wrap around" option
is turned on.
- AFL Engine: code refactoring for reduced size and improved speed
- AFL: when value of unsupported type was appended to string a crash could
occur. Fixed.
- AFL Engine: when
IIf was called the memory upsized from scalar to array could get freed twice
(wrong). Fixed
- AFL: MACD() and Signal() functions made faster (approx 1.5-2x times)
- Analysis: Interest
is added at the beginning of next bar (instead of end of current bar), to
account for overnight rate. This also fixes the problem of ignoring
interest in v.> 5.69
- UI: fixed yet another place where entering customization
changed working dir
If you experience any problem with this beta version please send detailed
description of the problem (especially the steps needed to reproduce it) to
support at amibroker.com