AmiBroker 5.26.0 Beta Read Me
May 8, 2009 16:30
THIS IS A BETA VERSION OF THE SOFTWARE. EXPECT BUGS !!!
Backup your data files and entire AmiBroker folder
first!
INSTALLATION INSTRUCTIONS
IMPORTANT: This archive is update-only. You have to install full version
5.20 first.
Just run the installer and follow the instructions.
Then run AmiBroker. You should see "AmiBroker 5.26.0 beta" written
in the About box.
See CHANGE LOG below for detailed list of changes.
CHANGE LOG
CHANGES FOR VERSION 5.26.0 (as compared to 5.25.0)
- Implemented user-definable report charts
Now it is possible for the user to create any number of charts that will
be automatically generated and included in the backtest report.
To add user-defined chart to the report, simply save your chart formula
under "Report Charts" folder.
That's all.
Any formula present in the "Report Charts" folder will be executed
after
completion of the backtest using ~~~EQUITY as selected symbol.
The beta ships with 3 sample charts:
a) portfolio equity
b) underwater equity (drawdown)
c) profit table
The charts are displayed in alphabetical order (using file name as a chart
name).
- Built-in price arrays (OHLC, V,
OI, Avg) are protected against assigning the value of wrong type (non-array)
CHANGES FOR VERSION 5.25.0 (as compared to 5.24.0)
- StaticVarGet() now has additional parameter - align
StaticVarGet("varname", align = True );
second parameter - 'align' - booleand True/False, default: True
- decides whenever AmiBroker performs timestamp synchronization/alignment
or not.
The default value is True and it means that values stored in static variables
are retrieved and aligned to currently selected symbol data/timestamp
on each bar basis so data for corresponding date/time stamps match.
This is recommended setting and this is the way it worked in previous versions.
When align is switched to False - it means that AmiBroker does not perform
any checks nor any alignment and will fill the array with consecutive values
stored in static array regardless of their timestamps.
If there are less bars in the static array than in the current arrays,
the last
value of static array will be propagated till BarCount - 1.
It is advised NOT to use align=False, unless you know exactly what you
are doing
and you are aware that date/time stamps have no meaning in particular variable
or in case when date/time stamps are are aligned using your own method.
Note that speed difference between align 'on' and 'off' is usually negligible
because alignment algorithm is very fast and has similar complexity as
plain
memory copy.
- AFL: HighestVisibleValue(
array ), LowestVisibleValue( array )
Two new functions that calculate single value (not array) representing
highest and lowest values of given array within VISIBLE range (on chart).
Should be applied only in indicators as only indicators have concept of "visible" bars.
The function will return Null value if no visible bars are present.
They are equivalent to the following coding:
function HighestVisibleValueEquivalent(
array )
{
bv = Status("barvisible");
Hh = -1e8;
for( i = 0;
i < BarCount;
i++ )
{
if(
bv[ i ] AND array[
i ] > Hh ) Hh = array[ i ];
}
return hh;
}
function LowestVisibleValueEquivalent(
array )
{
bv = Status("barvisible");
ll = 1e8;
for( i = 0;
i < BarCount;
i++ )
{
if(
bv[ i ] AND array[
i ] < ll ) ll = array[ i ];
}
return ll;
}
As you can see the AFL equivalent is simple, but native functions
are faster.
- When user picks a drawing tool, AmiBroker
offers switching to default layer (0) if current layer is not visible
- StaticVarRemove("varname")
now supports wildcards in the variable name
"varname" parameter can be either exact variable name or wildcard
match string.
The '*' matches any number of characters, including zero characters. The '?'
matches exactly
one character.
Example 1:
StaticVarRemove("MyVariables*");
// this will remove all static variables beginning with MyVariables prefix.
Example 2:
StaticVarSet("DifferentName", 1 );
printf( "Total
static variables = %g\n\n", StaticVarCount() );
for( i = 1;
i <= 5; i++ )
for( j = 1;
j <= 5; j++ )
{
VarName = "Test_X=" +
i + "_Y=" + j;
printf("Setting
variable " + VarName + "\n" );
StaticVarSet( Varname, 1 );
}
printf( "Total
static variables = %g\n\n", StaticVarCount() );
printf( "Now
wildcard remove *X=1*\n" );
StaticVarRemove( "*X=1*" );
printf( "Total
static variables = %g\n\n", StaticVarCount() );
printf( "Now
wildcard remove Test*\n" );
StaticVarRemove( "Test*" );
printf( "Total
static variables = %g\n\n", StaticVarCount() );
printf("Removing
'differenname' variable\n");
StaticVarRemove("DifferentName" );
printf( "Total
static variables = %g\n\n", StaticVarCount() );
- StaticVarCount function added
- returns the total number of static variables in memory
- Study() function
now allows to specify which Y scale to use (Study( studyid, chartid, scale
= -1))
Study( studyid, chartid = 1, scale = -1 )
scale parameter specifies which scale should be used
scale = -1 : automatic (default value) - either linear or logarithmic depending
on actual chart setting, chart is specified by chartID
scale = 0 : linear scale
scale = 1 : logarithmic scale
- data and optimizer plugins are loaded later (saves upto 15MB of RAM)
- Fixed
GetChartBkColor function
- "
show trading arrows" feature optimized for significantly lower CPU usage
- hi-density
(>2x more data bars than pixels) variable color styleHistogram
charts are plotted with correct colors
- less reallocations in real-time mode,
10% performance improvement and less fragmentation
- arrays for storing dynamic
stop levels are only allocated/filled when needed (saves about 10% of AFL
setup time)
- Added miny/maxy parameters to SetChartBkGradient (allows gradient
area charts in combination with cloud style)
Example Gradient Area chart:
function PlotGradientArea(
array, caption, ColorTop, ColorBottom )
{
bkclr = GetChartBkColor();
HH = HighestVisibleValue( array );
if( NOT IsNull(
hh ) ) SetChartBkGradientFill(
ColorTop, ColorBottom, bkclr, Null,
HH );
Plot( array, Caption, ColorBlend(
ColorBottom, colorBlack )
);
PlotOHLC( HH, HH, array,
HH, "", bkclr, styleNoLabel | styleNoTitle | styleCloud, Null, Null, 0,
-10 );
}
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}}
- {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )
) ));
PlotGradientArea( C, "Close", ParamColor("Top", colorLightOrange), ParamColor("Bottom", colorPaleGreen )
);
_SECTION_END();
CHANGES FOR VERSION 5.24.0 (as compared to 5.23.0)
- typeof() incorrectly returned compile-time type instead of run-time type.
Fixed.
- Static array variables implemented
StaticVarSet( name, value ) and
StaticVarGet( name )
AFL functions now accept arrays in addition to numbers (scalars).
Static arrays can be even 100 faster than AddToComposite/Foreign, however
these two are not strictly equivalent.
There are following limitations / differences of static arrays as compared
to Foreign/AddToComposite:
a) static array variables store only as many bars as there are currently
in use by given chart
(so they do not affect QuickAFL in any way). This is different that AddToComposite
that forces usage and store of all bars.
b) static array variables work best if you read them using the same interval
as they were written to. I.e when you create static array variables using
5-minute chart, for best results read them in some other 5-minute chart.
Reading in different intervals is possible, but subject to limitations
of timestamping (see below)
c) when you read static variable in a different interval that it was originally
stored,
static variables perform padding/synchronization and time compression/decompression
automatically in a similar way as foreign,
however Foreign compresses data always from base-time interval, while static
variables operate on previously stored interval,
hence result may differ. For example, if previously stored data was in
daily interval, and you read such static variable in intraday
chart, you will see essentially flat lines for each day, representing static
data from daily interval.
d) static array variables do not work well for non-time based intervals
(tick/n-volume/n-tick) because timestamps in those intervals
may not be unique (i.e. several bars may have same time stamp), so time
synchronization is not reliable.
e) static array variables are little slower than normal AFL variables,
so for best performance, use read-once, write-once paradigm, using
temporary normal variable for any processing during formula execution,
like this:
// start of the formula:
temp = StaticVarGet("mystaticarray" );
// now perform all necessary calculations using temp variable
temp = Nz(temp) + C/2;
...
// at the end of the formula store to static
StaticVarSet("mystaticarray", temp );
CHANGES FOR VERSION 5.23.0 (as compared to 5.22.0)
- Font used by progress window, string input, tip of the day, search file
is now "MS Shell Dlg" (the same as elsewhere in AB) that means
that is CoolType friendly (TTF)
- AFL: SetOption("ExtraColumnsLocation",
col) - this new option allows the user to change the location of custom columns
added during backtest/optimization
"extra" columns mean:
a) any custom metrics added using custom backtester
b) any optimization parameters defined using Optimize() function
If both custom metrics and optimization parameters are present then
custom metrics appear first then optimization parameters
This function is provided to allow the user to change the default "at
the end" location of custom columns/optimization parameters.
For example
SetOption("ExtraColumnsLocation", 1 );
will cause that custom metrics and opt params will be subsequently added
starting from column 1 (as opposed to last column default)
Note that this setting changes "visual" order of columns, not
really in-memory order or export order, so
exported data files or copy/paste format do not change.
- Implemented hiding columns in all list
views (right click over list view HEADER to bring "Setup Columns" dialog)
- Storing
column state (widths/ordering/visibility) in automatic analysis implemented
The widths, ordering and visibility of all built-in columns in automatic-analysis
is stored between runs.
This works for each operation mode (i.e. scan/backtest/optimization) separately,
so column setup
for scan does not affect stored column order for backtest, as well as state
of columns for optimization does not
affect backtest, etc.
Note also that state of exploration mode is not stored, due to its complete
user-configurability from AFL level.
- Data
Window implemented (available from View->Data Window menu)
(if you can not see this menu, you would need to reset the menu using Tools->Customize,
select "Menu Bar" and then press "Reset" button).
If you prefer to use Data Window over data tooltips, you can turn off data
tooltips using Tools->Preferences, "Miscellaneous" tab, UNCHECK "Price
data tooltips" box.
- Home key was
working incorrectly when more than one pane was used in the chart. Fixed
- Implemented
simple performance monitor Tools->Performance Monitor
Showing some memory and usage statistics:
- number of symbols in the database
- number of symbols cached in RAM
- quotation data memory usage
- current symbol memory usage
- total chart refresh time
- real-time data stream update frequency
The contents of the window is updated automatically every 3 seconds
This tool is intended to be used now for two purposes:
a) tweaking cache settings for best RAM usage (for example optimizations
will run faster if all quotation data can be kept in RAM)
b) monitoring real-time performance
More uses will probably come in the future.
- Time&Sales window
now shows some "recent statistics" regarding
trading
Time&Sales window now shows some "recent statistics" regarding
trading namely:
- number of trades and average # of trades per second
- number of trades and shares traded at ask or above
- number of trades and shares traded at bid or below
- ask minus bid difference expressed in number of trades and shares
- ask minus bid difference expressed as percentage ratio to total trades/total
volume traded
A little background:
Ask minus bid: the positive numbers represent more transactions occuring
on ASK side than on BID side.
This in theory may mean more buying than selling, but in practice things
are largely dependent
on security traded. Esp. dark liquidity pools do not show in order books
and
may report trades to the tape several seconds later thus invalidating relationship
between
bid/ask and actual trade prices.
IMPORTANT:
These are temporary, short-term stats - they cover ONLY trades displayed
in the T&S window since opening of the window OR
resetting stats.
You can reset statistics using right click menu : "Reset Stats"
CHANGES FOR VERSION 5.22.0 (as compared to 5.21.0)
- added ability to extend blank chart area by pressing END key multiple times
(each time 10 blank bars are added) and restoring preferences value by subsequent
pressing of HOME key.
- added option to always require variable declarations (using
local/global) on formula-by-formula basis:
SetOption("RequireDeclarations", True );
global test1;
test1 = 5; // OK variable declared
test2 = 3; // error: assignment without declaration
- added typeof() operator
The typeof operator is used in the following way:
typeof (operand)
The typeof operator returns a string indicating the type of the *unevaluated*
operand. operand is the string, variable, function identifier, or object
for which the type is to be returned.
When supplying identifier, it should be provided alone, without arithmetic
operators, without extra arguments and without braces.
If you want to check the type of value returned by the function, you must
first assign the return value to a variable and then use
typeof( variable ).
Possible return values are:
"
undefined" - identifier is not defined
"
number" - operand represents a number (scalar)
"
array" - operand represents an array
"
string" - operand represents a string
"
function" - operand is a built-in function identifier
"
user function" - operand is a user-defined function
"
object" - operand represents COM object
"
member" - operand represents member function or property of COM object
"
handle" - operand represents Windows handle
"
unknown" - type of operand is unknown (should not happen)typeof operator
allows among other things to detect undefined variables in the following
way
if( typeof( somevar ) == "undefined" )
{
/// when somevar is undefined the code here will execute
}
The following sample COMMENTARY code shows the output of
typeof in some common situations
x = MACD();
y = LastValue( x );
function testfun() { return 1; };
printf( typeof( test ) + "\n" ); // the undefined variable
printf( typeof( 1 ) + "\n"); // literal number
printf( typeof( "checking" ) + "\n"); // literal string
printf( typeof( x ) + "\n"); // array variable
printf( typeof( y ) + "\n"); // scalar variable
printf( typeof( MACD ) + "\n"); // function identifier
printf( typeof( testfun ) + "\n" ); // user function identifier
- GetSignalQty member function of Backtester object
returned zero. Fixed now
- In the Plot() function Xshift parameter was used
as z-order in 5.21 beta. Fixed now.
- Plot, PlotOHLC and PlotForeign() are no
longer limited to -5..+5 zorder range. You can use any zorder value now.
Note that if you use zorder outside default range -5..+5, you may see performance
degradation for big positive and big negative z-order values.
Approximate performance penalty is 10 milliseconds for 100 z-orders (or 1ms
for 10 z-orders)
- SetChartOptions now adds ability to programmatically extend blank space
on chart-by-chart basis
SetChartOptions( Mode = 0, Flags = 0, gridFlags = chartGridMiddle, ymin = 0,
ymax = 0, blankbars = 0 )
New, 6th parameter "blankbars" defines the minimum number of blank
bars for given chart. The default value of zero means no change
(use preferences setting).
if specified value is less than value set in preferences, it is ignored, so
you can not decrease the blank bars below value set in preferences.
if many panes within same chart use this function, then the largest specified
blankbars will be used
Note that you can still extend blank space further using END key.
Special feature - if "blankbars" is negative then extra blank bars
added are equal to absolute value of blankbars parameter plus chart gets scrolled
to rightmost position.
Caveat: forcing custom blankbars via SetChartOptions effectivelly disables
HOME key scroll to begin operation.
- the feature to extend blank area via mouse wheel and > button
is removed, due to complaints received
CHANGES FOR VERSION 5.21.0 (as compared to 5.20.0)
- Added optional data padding for non-trading days (switchable from View->Pad
non-trading days menu) - for daily and higher intervals only (FC#1136,FC#1174)
- All drawing tools
now can define Z-order (from -5 to +5).
Z-order.
Imagine that you could see the drawing objects arranged on the chart page like
puzzle pieces on a table. Some objects may appear to be placed one on top of
another, and others may be overlapping.
This third dimension of chart page is known as "Z order." If the
X axis relates to width and the Y axis to height, then the Z order relates
to depth. Although Z order cannot be seen directly, just as can you position
objects along X and Y (horizontal and vertical) axes, you can also position
them in the Z order.
Every object on the page has its Z order, positioned in back to front order,
so that objects at the front will take precedence over objects behind.
Z order gives you the ability to superimpose objects one on top of another.
You can change Z-order parameter using Properties dialog
as well as using Format->Z-Order->Bring Forward / Send Backward menus
(and default keystrokes Shift+Page Up, Shift+Page Down)
Negative values mean BEHIND axis/grid, positive mean above grid.
- Blank area past last available quote
can be now enlarged on the fly by simply using > arrow in the scroll bar
or using mouse wheel (just roll the wheel past the last bar) (FC #430,#1516,
#1500, #1239, #982, #808, #561 )
- CBT: Backtester.GetSignalQty(
bar, type ) method implemented (FC#1671)
Backtester object
GetSignalQty( bar, type ) method
- retrieves the number of signals occuring on given bar
type = 0 - both entry and exit signals
type = 1 - only entry signals
type = 2 - only exit signals
Note that AmiBroker to conserve memory keeps track only of 2 * MaxNumberOfPositions
entry signals on any single bar,
however it keeps track of ALL exit signals (because they consume much less
space and at the time of signal collection
it is not known which positions are already open, so all exits must be tracked
to prevent missing an exit)
- E-mail alerts can now be sent through different
port than 25 (see Tools->Preferences->Alerts) (FC#1641)
- Early warning of indicator space running out. At application
exit the message is displayed when less than 10% indicator space is left,
plus an offer to
run Indicator Maintenance (FC#1667)
- new AFL functions ColorBlend
ColorBlend( colorFrom, colorTo, factor = 0.5 )
- the function blends (mixes) colorFrom with colorTo with 'factor' proportion
using the following algorithm
RGB = ( 1 - factor ) * RGB(colorFrom) + factor * RGB(colorTo );
So factor = 0 means use colorFrom only, factor = 1 means use colorTo only.
All in-between values
mean create mix of colors. The lower the factor value means more colorFrom.
This function makes it easy to lighten or darken colors like this:
function ColorLighten( color )
{
return ColorBlend( color, colorWhite, 0.5 );
}
function ColorDarken( color )
{
return ColorBlend( color, colorBlack, 0.5 );
}
- Plot, PlotForeign and PlotOHLC now have new
parameter zorder which defines the Z-axis position of given plot. (FC#257)
zorder can be set from -5 to 5.
The default is zero.
Zorder = 0 means also where the "grid" is located.
So if you want to plot BEHIND the grid
you need to specify negative zorder parameter.
Smaller values mean draw first (i.e. BEHIND others), higher values mean draw
later (ON TOP of others).
Plots are drawn in the following order:
- zorder parameter takes precedence over
the order of calling Plot() functions, so if z-order is set,
it determines plotting order.
See http://www.amibroker.com/gifs/zorder.gif
- If
multiple plots use the same z-order parameter they are plotted in reverse
call order (ones that appear last in the code are plotted first). This
rule can be changed by already existing switch graphzorder = 1 which,
when specified,
reverses this behaviour (so plots are drawn in call order).
Please note
the above applies to each zorder "layer" separately (so
within same zorder "layer" reverse call rule applies)
This may sound complicated but is required for backward compatibility.
Example:
Bollinger bands with "cloud" fill behind price (zorder =
-1)
P = ParamField("Price
field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Style = ParamStyle("Style")
| styleNoRescale;;
Plot( bbt = BBandTop(
P, Periods, Width ), "BBTop" + _PARAM_VALUES(),
Color, Style );
Plot( bbb = BBandBot(
P, Periods, Width ), "BBBot" + _PARAM_VALUES(),
Color, Style );
PlotOHLC( bbt,
bbt, bbb, bbb, "", ColorBlend(
Color, colorWhite, 0.9 ), styleCloud, Null, Null, Null,
-1 );
- Rectangle
and Ellipse drawing tool now are by default SOLID, with default fill color
being a blend between background and selected drawing color, they
are use ZOrder = -1 (behind regular plots) by default
- Support for SSL (secure
connection) e-mail alerts added, so now you can use your GMail accounts. (FC#83)
Steps:
1. Download and install AmiBroker 5.21 or higher
2. Download and run SSL add-on from http://www.amibroker.com/bin/SSLAddOn.exe
3. Configure (Tools->Preferences->Alerts) with SSL enabled as shown in
this picture:
http://www.amibroker.com/gifs/gmailalert.gif
- X-Y
co-ordinate labels on axes implemented. Can be controlled using View->X-Y
labels menu. (FC#1621, FC#732)
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