[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] AmiBroker 5.05.1 BETA



PureBytes Links

Trading Reference Links

Yes you can optimize for any custom metric. Just enter the name of custom metric in the
"optimization target" field in AA-Settings->Walk Forward.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Thomas Z." <tzg@xxxxxxxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, February 12, 2008 7:22 PM
Subject: RE: [amibroker] AmiBroker 5.05.1 BETA


Hello Tomasz,

i'm surprised about the Walk Forward optimizaton. It's really excellent.
Is it maybe already somehow possible to opimize for custom backtest stats or
do you plan to implement it?


Thomas
www.PatternExplorer.com



From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Tomasz Janeczko
Sent: Tuesday, February 12, 2008 1:49 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] AmiBroker 5.05.1 BETA

Hello,
A new beta version (5.05.1) of AmiBroker has just been released.
http://www.amibroker.com/devlog/2008/02/12/amibroker-5051-beta-released/
HIGHLIGHTS of this version: 
1. automatic Walk-Forward Optimization, with IS and OOS equity charts 
2. new functionality in GetCursor* AFL functions allowing interactive
control (see sample in the read me) 
3. automatic formula formatting - "Code Prettify" in the AFL Editor:
Edit->Prettify selection 
4. Improved scaling of semi-log charts 
This version includes also features introduced earlier (in 5.03) such as new
interval and symbol linking.
BELOW you will find some additional information about walk-forward
optimization introduced in this beta.

Best regards,
Tomasz Janeczko
amibroker.com

WALK FORWARD OPTIMIZATION

The automatic Walk forward optimization is a system design and validation
technique in which
you optimize the parameter values on a past segment of market data
("in-sample"), then test the system forward in time on data following the
optimization segment ("out-of-sample"). You evaluate the system based on how
well it performs on the test data ("out-of-sample"), not the data it was
optimized on. 

To use Walk-Forward optimization please:
1. Go to Tools->Automatic Analysis
2. Click Settings button, then switch to "Walk-Forward tab"
3. Here you can see Walk forward settings for In-sample optimization,
out-of-sample backtest
"Start" and "End" dates mark initial period begin / end
This period will be moved forward by "Step" until the "End" reaches the
"Last" date.
The "Start" date can move forward by "step" too, or can be anchored
(constant) if "Anchored" check is on.
If you mark "Use today" then "Last" date entered will be ignored and TODAY
(current date) will be used instead

By default an "EASY MODE" is selected which simplifies the process of
setting up WF parameters.
It assumes that:
a) Out-of-sample segment immediatelly follows in-sample segment
b) the length of out-of-sample segment equals to the walk-forward step

Based on these two assumptions the "EASY" mode takes in-sample END date and
sets
out-of-sample START date to the following day. Then adds in-sample STEP and
this becomes out-of-sample END date.
In-sample and Out-of-sample step values are set to the same values.

The "EASY" mode guarantees correctness of WF procedure settings.

In the "ADVANCED" mode, the user has complete control over all values, to
the extent that
they may not constitute valid WF procedure.
The interface allows to selectivelly disable in-sample and out-of-sample
phases using checkboxes at top
(for special things like runnign sequential backtests without
optimization). 

All settings are immediatelly reflected in the PREVIEW list that shows all
generated IS/OOS segments
and their dates.

The "Optimization target" field defines the optimization raport COLUMN NAME
that
will be used for sorting results and finding the BEST one. Any built-in
column can be used
(as appears in the optimization output), or you can use any custom metric
that you define
in custom backtester. The default is CAR/MDD, you can however select any
other built-in metric from the combo.
You can also TYPE-IN any custom metric that you have added via custom
backtester interface.

4. Once you defined Walk-Forward settings, please go to Automatic Analysis
and
5. press the dropdown ARROW on the Optimize button and select "Walk Forward
Optimization"
This will run sequence of optimizaitons and backtest and the results will
be displayed in
the "Walk Forward" document that is open in the main application frame.
When optimization is running you can click "MINIMIZE" button on the Progress
dialog
to minimize it - this allows to see the Walk Forward output during the
optimization steps.
IN-SAMPLE and OUT-OF-SAMPLE combined equity

Combined in-sample and out-sample equities are available by
~~~ISEQUITY and ~~~OSEQUITY composite tickers
(consecutive periods of IS and OOS are concatenated and scaled to
maintain continuity of equity line - this approach assumes that you
generally speaking are compounding profits)
To display IS and OOS equity you may use for example this:
PlotForeign("~~~ISEQUITY","In-Sample Equity", colorRed, styleLine); 
PlotForeign("~~~OSEQUITY","Out-Of-Sample Equity", colorGreen, styleLine); 
Title = "{{NAME}} - {{INTERVAL}} {{DATE}} {{VALUES}}"; 


INTERACTIVE "BUTTONS" SAMPLE

New functionality in GetCursor* functions:
GetCursorXPosition( mode = 0 )
GetCursorYPosition( mode = 0 )
mode = -1 - (old compatibility mode) - x - value gives X-coordinate in
DateTime format. y - value gives PRICE. Values are reported no matter where
is the mouse (i.e. may refer to window different than current if mouse is
outside current window).
mode = 0 - (default) x - value gives X-coordinate in DateTime format. y -
value gives PRICE. Returns NULL if mouse is outside current window
mode = 1 - x, y - are mouse coordinates expressed in screen PIXELS. Returns
NULL if mouse is outside current window
GetCursorMouseButtons new output flag = 8 - means that current chart just
received mouse click
Code sample:
///////////////////////////////////////////////// 
// Low-level graphic + Interactive GUI control sample 
// This example shows: 
// 1. how to draw "buttons" 
// 2. how to handle mouse clicks 
// 3. how to implement event call-backs 
/////////////////////////////////////////////////// 

Version( 5.04 ); // requires 5.04 or higher 

//////////////////////////////////////////////////// 
// Part 1: DRAWING TABLE OF BUTTONS 
////////////////////////////////////////////////// 
GfxSetOverlayMode( 2 ); 
// formatted text output sample via low-level gfx functions 

CellHeight = 20; 
CellWidth = 100; 
GfxSelectFont( "Tahoma", CellHeight/2 ); 

GfxSetBkMode( 1 ); 

function PrintInCell( string, row, Col ) 
{ 
GfxDrawText( string, Col * CellWidth, row * CellHeight, (Col + 1 ) *
CellWidth, (row + 1 ) * CellHeight, 0 ); 
} 

GfxSelectPen( colorBlue ); 
for( i = 0; i < 10 && i < BarCount; i++ ) 
{ 
for( k = 0; k < 5; k++ ) 
{ 
PrintInCell( "Button " + i + "," + k, i, k ); 
} 
GfxMoveTo( 0, i * CellHeight ); 
GfxLineTo( 5 * CellWidth, i * CellHeight ); 
} 
GfxMoveTo( 0, i * CellHeight ); 
GfxLineTo( 5 * CellWidth, i * CellHeight ); 

for( Col = 1; Col < 6; Col++ ) 
{ 
GfxMoveTo( Col * CellWidth, 0); 
GfxLineTo( Col * CellWidth, 10 * CellHeight ); 
} 


///////////////////////////////////////////////////////// 
// Part 2: MOUSE BUTTON CALL BACKS 
////////////////////////////////////////////////////////// 
Title=""; 

function DrawButton( px, py, Clr1, Clr2, text ) 
{ 
Col = floor( px / CellWidth ); 
Row = floor( py / CellHeight ); 


GfxGradientRect( Col * CellWidth, row * CellHeight, (Col + 1 ) *
CellWidth, (row + 1 ) * CellHeight, 
Clr1, Clr2 ); 

PrintInCell( text + " " + row + "," + Col, row, Col ); 

} 

function OnLMouseButton(x, y, px, py) 
{ 
_TRACE("LButton x = " + DateTimeToStr( x ) + " y = " + y ); 

DrawButton( px, py, ColorHSB( 50, 255, 255 ), ColorHSB( 90, 255, 255 ),
"just clicked" ); 
} 

function OnRMouseButton(x, y, px, py) 
{ 
_TRACE("RButton x = " + DateTimeToStr( x ) + " y = " + y ); 
} 

function OnMMouseButton(x, y, px, py) 
{ 
_TRACE("MButton x = " + DateTimeToStr( x ) + " y = " + y ); 
} 

function OnHoverMouse(x, y, px, py) 
{ 
_TRACE("LButton x = " + DateTimeToStr( x ) + " y = " + y ); 

DrawButton( px, py, ColorRGB( 230, 230, 230 ), ColorRGB( 255, 255, 255
), "mouse over" ); 
} 

function OnLButtonIsDown(x, y, px, py) 
{ 
_TRACE("LButton x = " + DateTimeToStr( x ) + " y = " + y ); 

DrawButton( px, py, ColorHSB( 190, 255, 255 ), ColorHSB( 210, 255, 255
), "down" ); 
} 

///////////////////////////////////////////////////////// 
// Part 3: GENERAL PURPOSE EVENT HANDLER (reusable! - may be put into
"include" file) 
//////////////////////////////////////////////////////// 

function EventHandler() 
{ 
local b, x, y, px, py; 
b = GetCursorMouseButtons(); 

// retrieve co-ordinates in date/value units 
x = GetCursorXPosition(0); 
y = GetCursorYPosition(0); 

// retrieve co-ordinates in pixel units 
px = GetCursorXPosition(1); 
py = GetCursorYPosition(1); 

if( b & 8 ) // flag = 8 is set when window just received mouse click 
{ 
// not-null means clicked in THIS (current) window 
if( b & 1 ) OnLMouseButton( x, y, px, py ); 
if( b & 2 ) OnRMouseButton( x, y, px, py ); 
if( b & 4 ) OnMMouseButton( x, y, px, py ); 
} 
else 
{ 
if( b == 0 ) OnHoverMouse( x, y, px, py ); // no button pressed 
if( b == 1 ) OnLButtonIsDown( x, y, px, py ); // button pressed 
} 
} 

EventHandler(); 
RequestTimedRefresh( 1 ); 
 



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links





Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/