August 19, 2012 9:55
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.50 first.
Just run the installer and follow the instructions.
Then run AmiBroker. You should see "AmiBroker 5.57.1 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.57.1 (as compared to 5.57.0)
CHANGES FOR VERSION 5.57.0 (as compared to 5.56.0)
D, h, m, s, T, R, V intervals can be preceded by a number. So if you type
15m it means 15 minute chart,
if you type 13T it means 13 tick chart, if you type 200R it means 200R (range)
chart.
If you type just a number (x) without the following letter it will treat it
as x-minute chart.
Note that while AmiBroker is trying to keep layout files backward compatible,
attempt to load the layout that uses 'new' interval that is not present in
defined set into *old* (pre-5.57) version will result in this extra interval
being
replaced by simply daily chart.
CHANGES FOR VERSION 5.56.0 (as compared to 5.55.1)
Summary report shows the note that built-in metrics correctly represent
all out-of-sample steps
but summary custom metrics are composed using user-definable method:
1 first step value, 2 last step value, 3 sum, 4 average, 5 minimum, 6 maximum.
By default summary report shows last step value of custom metrics UNLESS
user specifies different combining method in
bo.AddCustomMetrics() call. bo.AddCustomMetrics has now new optional parameter
- CombineMethod
bool AddCustomMetric( string Title, variant Value, [optional] variant LongOnlyValue, [optional] variant ShortOnlyValue , [optional] variant DecPlaces = 2, [optional] variant CombineMethod = 2 )
This method adds custom metric to the backtest report, backtest "summary" and optimization result list. Title is a name of the metric to be displayed in the report, Value is the value of the metric, optional arguments LongOnlyValue, ShortOnlyValue allow to provide values for additional long/short-only columns in the backtest report. Last argument DecPlaces controls how many decimal places should be used to display the value.
Supported CombineMethod values are:
1 first step value, - summary report will show the value of custom metric
from very first out-of-sample step
2 last step value (default), - summary report will show the value of custom
metric from the last out-of-sample step
3 sum, - summary report will show the sum of the values of custom metric
from all out of sample steps
4 average, - summary report will show the average of the values of custom
metric from all out of sample steps
5 minimum, - summary report will show the smallest value of custom metric
from all out of sample steps
6 maximum.- summary report will show the largest value of custom metric from
all out of sample steps
Note that certain metrics calculation methods are complex and for example
averaging them would not lead to mathematically correct representation of
all out of sample test.
Summaries of all built-in metrics are mathematically correct out-of-the-box
(i.e. they are *not* averages, but properly calculated metrics using method
that is appropriate for given value). This contrasts with custom metrics,
because they are user-definable and it is up to the user to select 'combining'
method, and still it may happen that none of the available methods is appropriate.
For that reason the report includes the note that explains what user-definable
method was used to combine custom metrics.
As of now the following metrics are colorized:
Net Profit, Net Profit % - bad < 0, good > 0
Annual Profit %, bad < 0, neutral betwen 0 and 10, good > 10
RAR % bad < 0, good > (10 / Exposure)
Avg. Profit/Loss all trades (Expectancy $) - bad < 0, good > 0
Avg Profit/Loss % all trades (Expectancy %) - bad < 0, good > 0
Max. system % drawdown - bad: dd worse than -30%, neutral: dd between -30
and -10%, good - -10% to 0%
CAR/MaxDD, RAR/MaxDD - bad < 1, neutral between 1 and 2, good > 2
Recovery factor - bad < 1, neutral between 1 and 2, good > 2
Payoff ratio - bad < 1, neutral between 1 and 2, good > 2
CHANGES FOR VERSION 5.55.1 (as compared to 5.54.0)
The function queries current state of keyboard keys (at the time of the call).
vkey is virtual key code to query (see table below).
The function returns 0 if key is NOT pressed and value < 0 ( less than
zero) when key is currently pressed.
Example:
Plot( C, "Close", colorRed );
vk_Shift = 16;
if( GetAsyncKeyState(
vk_Shift ) < 0 ) Title = "Shift
is pressed";
Virtual Key codes:
vk_BackSpace = 8;
vk_Tab = 9;
vk_Return = 13;
vk_Shift = 16;
vk_Control = 17;
vk_Alt = 18;
vk_Pause = 19;
vk_CapsLock = 20;
vk_Escape = 27;
vk_Space = 32;
vk_PageUp = 33;
vk_PageDown = 34;
vk_End = 35;
vk_Home = 36;
vk_Left = 37;
vk_Up = 38;
vk_Right = 39;
vk_Down = 40;
vk_PrintScreen = 44;
vk_Insert = 45;
vk_Delete = 46;
/* NOTE: vk_0..vk_9 vk_A.. vk_Z match regular ASCII codes for digits and A-Z letters */
vk_0 = 48;
vk_1 = 49;
vk_2 = 50;
vk_3 = 51;
vk_4 = 52;
vk_5 = 53;
vk_6 = 54;
vk_7 = 55;
vk_8 = 56;
vk_9 = 57;
vk_A = 65;
vk_B = 66;
vk_C = 67;
vk_D = 68;
vk_E = 69;
vk_F = 70;
vk_G = 71;
vk_H = 72;
vk_I = 73;
vk_J = 74;
vk_K = 75;
vk_L = 76;
vk_M = 77;
vk_N = 78;
vk_O = 79;
vk_P = 80;
vk_Q = 81;
vk_R = 82;
vk_S = 83;
vk_T = 84;
vk_U = 85;
vk_V = 86;
vk_W = 87;
vk_X = 88;
vk_Y = 89;
vk_Z = 90;
vk_LWin = 91;
vk_RWin = 92;
vk_Apps = 93;
/* numerical key pad */
vk_NumPad0 = 96;
vk_NumPad1 = 97;
vk_NumPad2 = 98;
vk_NumPad3 = 99;
vk_NumPad4 = 100;
vk_NumPad5 = 101;
vk_NumPad6 = 102;
vk_NumPad7 = 103;
vk_NumPad8 = 104;
vk_NumPad9 = 105;
vk_Multiply = 106;
vk_Add = 107;
vk_Subtract = 109;
vk_Decimal = 110;
vk_Divide = 111;
/* function keys */
vk_F1 = 112;
vk_F2 = 113;
vk_F3 = 114;
vk_F4 = 115;
vk_F5 = 116;
vk_F6 = 117;
vk_F7 = 118;
vk_F8 = 119;
vk_F9 = 120;
vk_F10 = 121;
vk_F11 = 122;
vk_F12 = 123;
vk_F13 = 124;
vk_F14 = 125;
vk_F15 = 126;
vk_F16 = 127;
vk_NumLock = 144;
vk_ScrollLock = 145;
vk_LShift = 160;
vk_RShift = 161;
vk_LControl = 162;
vk_RControl = 163;
vk_LAlt = 164;
vk_RAlt = 165;
vk_SemiColon = 186;
vk_Equals = 187;
vk_Comma = 188;
vk_UnderScore = 189;
vk_Period = 190;
vk_Slash = 191;
vk_BackSlash = 220;
vk_RightBrace = 221;
vk_LeftBrace = 219;
vk_Apostrophe = 222;
Supported "field" values are:
"
list" - returns the list of static variables
"
memory" - returns memory usage in bytes (not including memory used
for variable name itself)
"
totalmemory" - returns memory usage in bytes (including memory used
for variable name)
Example:
StaticVarSet("my_array1", Close );
StaticVarSet("my_array2", Close );
StaticVarSet("my_scalar", 12 );
StaticVarSetText("my_text", "Text123456" );
"All variables in memory: " +
StaticVarInfo( "*", "list" );
" Total static var memory: " +
StaticVarInfo( "*", "totalmemory");
" Only my_ variables: " +
StaticVarInfo( "my_*", "list" );
" Memory 2 arrays (bytes): " +
StaticVarInfo( "my_array*", "memory" );
" Memory scalar (bytes): " +
StaticVarInfo( "my_scalar", "memory" );
" Memory text (bytes): " +
StaticVarInfo( "my_text", "memory" );
CHANGES FOR VERSION 5.54.0 (as compared to 5.53.1)
// XY chart coding example
// This formula generates 2 X-Y scatter charts
that display relationship between
// final trade profit and MFE and MAE
Buy = Cross( MACD(), Signal());
Sell = Cross( Signal(), MACD()
);
Short = False;
Cover = False;
Eq = Equity( 1 ); //
single-security equity this evaluates stops (if you use them)
and removes extra signals
Entry = Buy OR Short;
EqAtEntry = ValueWhen(
Entry, Eq );
Profit = 100 * ( Eq
- EqAtEntry ) / EqAtEntry; // percent profit
// MAE and MFE below use CLOSING equity, MAE and
MFE in the report use high/low price
MAE = 100 * ( LowestSince(
Entry, Eq ) - EqAtEntry ) / EqAtEntry; // percent
MAE
MFE = 100 * ( HighestSince(
Entry, Eq ) - EqAtEntry ) / EqAtEntry; // percent
MAE
bi = BarIndex();
Len = bi - ValueWhen(
Entry, bi );
EntryPrice = ValueWhen(
Entry, BuyPrice );
// if you prefer MAE/MFE using high/low price
// uncomment the lines below (long only Version)
MAE = 100 * ( LowestSince(
Entry, Low )
- EntryPrice ) / EntryPrice ; // percent MAE using
low
MFE = 100 * ( HighestSince(
Entry, High )
- EntryPrice ) / EntryPrice ; // percent MAE using
high
Exit = Sell OR Cover;
dt = DateTime();
Clr = ColorHSB( Status("stocknum"), 255, 255 );
for( bar = 0;
bar < BarCount;
bar++ )
{
if(
Exit[ bar ] )
{
// item text
consists of two parts
// first part
(before \t) is a item name displayed immediatelly on XY chart
// second
part (after \t) is a tooltip hint text that is displayed in the tooltip
// when you
hover on given item
// here we
will only use hint text
HintText = "\t" + Name()+"@"+ DateTimeToStr(
dt[ bar ] );
XYChartAddPoint( "Profit vs MAE",
HintText, MAE[ bar ], Profit[ bar ],Clr );
XYChartAddPoint( "Profit vs MFE",
HintText, MFE[ bar ], Profit[ bar ], Clr );
XYChartAddPoint( "Profit vs trade length",
HintText, Len[ bar ], Profit[ bar ], Clr );
}
}
XYChartSetAxis( "Profit vs MAE", "[MAE]", "[Profit]" );
XYChartSetAxis( "Profit vs MFE", "[MFE]", "[Profit]" );
XYChartSetAxis( "Profit vs trade length", "[Length]", "[Profit]" );
Filter = Exit;
AddColumn( Eq, "Equity" );
AddColumn( Profit, "Profit" );
AddColumn( MAE, "MAE" );
AddColumn( MFE, "MFE" );
AddColumn( Len, "trade
length" );
CHANGES FOR VERSION 5.53.1 (as compared to 5.53.0)
CHANGES FOR VERSION 5.53.0 (as compared to 5.52.0)
CHANGES FOR VERSION 5.52.0 (as compared to 5.51.2)
SetChartGradientFill( colorLightOrange, colorPaleGreen );
Plot( C, "Close", ColorBlend( colorPaleGreen, colorBlack ),
styleGradient | styleLine, Null, Null, 0,
-1 );
Plot( C, "Close", colorBlack, styleBar, Null, Null, 0, 1,
-20 /*
line width as percent of bar */ );
CHANGES FOR VERSION 5.51.2 (as compared to 5.51.1)
CHANGES FOR VERSION 5.51.1 (as compared to 5.51.0)
CHANGES FOR VERSION 5.51.0 (as compared to 5.50.5)
HOW TO REPORT BUGS
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