AmiBroker Backtesting with Walk Forward Manager (BTWFMgr)
(Professional Software Solutions)

Now BTWFMgr is also available for the AmiBroker platform!
The following topics are available for BTWFMgr and AmiBroker:

  Use the 64Bit PSS_AB.DLL file and store in: C:\Program Files\AmiBroker\Plugins\PSS_AB.DLL (272 KB = 279,040 bytes)
Then exit AmiBroker and re-open AmiBroker x64 and check with Tools/Plugins if the "Backtest+WalkFwd PlugIn 1.6" appears:
The Tool/sPlugins should show the new 1.6 Version:

AmiBroker 64Bit Versions (5.50)  
The first time you open Amibroker x64 to might see:
Tutorial Watch a detailed tutorial how to download BTWFMgr with AmiBroker   and
Watch a detailed tutorial how to prepare and optimize your system with AmiBroker
Watch other tutorials presenting the many BTWFMgr functions
Download Download the BTWFMgr/AmiBroker  version out for free for 15 days
Settings Suggested AmiBroker Settings
Prepare How to prepare your AmiBroker Strategy for BTWFMgr
Compare Compare how BTWFMgr replicates the AmiBroker results precisely
EquityGraph View instantly the Equity Graph and positions for each backtest permutation
WalkFwd Learn more about the poweful "Walk-Forward" analysis method
BTWFMgr Test drive the many powerful BTWFMgr functions and analysis tools
Import Import SPY 15Min test data
DateFormat and Diagnostics
  AmiBroker 32-bit Edition: use the previous 32bit PSS_AB.DLL file

The location were the "Diamond Backtesting with Walk Forward Manager" will be installed is: "C:\BTWFMgr"

Compare AmiBroker and BTWFMgr

BTWFMgr replicates the exact equity and performance as shown in AmiBroker when you run an optimization or backtest!
In this example the top equity results (1910.40, 1586.12, 1538.01 etc) match the "Diamond Backtesting" window,
which shows also a distribution of all the equity results and the average equity (around $200):

(Internally BTWFMgr is setting the CalcPL switch in the "Initial conversation" config section to YES)

Equity Graph

You can also instantly view and analyze EACH backtesting equity graph/result instantly
by clicking in the green permutation icon ($1910.49) and even see each position as shown below:

Ho to prepare your System/Strategy in AmiBroker (AB)_Prep)
In order to use the powerful BTWFMgr functions - you have to convert your AmiBroker System/Strategy in this simple step.
a) Start the "AmiBroker BTWF Code Preparation" utility
Start/Programs/Amibroker Backtesting with Walk Forward Manager (BTWFMgr)/Amibroker_BTWF_Code_Prepapartion -OR-
click in BTWFMgr on Functions/Prepare your Strategy for BTWFMgr -OR-
click on the blue exclamation mark icon the BTWFMgr icon
b) When the "AmiBroker BTWF Code Preparation" opened - select the system you want to prepare for optimizations:

Automatically the different Input names are shown the system is using.
c) Click on the "Prepare" button
d) Choose from:

YES=Replace the converted/prepared system AFL file
NO=Create a new converted/prepared system AFL file with "-BT" added to the filename
Cancel=stop the preparation process
e) View converted File
If the "Show File" box is enabled the program will automatically display the
converted AFL file (

AFL "Optimize" code lines
The prepapartion program (AB_Prep) will automatically scan all the AFL files in the Formula folders
and select all the systems which contain lines like:
Variable = Optimize ( "Name", Default,...);
RSILength = Optimize("RSILength", 11, 6, 20, 1 );
RSIValue = RSI(RSILength);

Note that you should always use variables before using the optimize parameter in the code as shown above,
so that the program can pass on the value of the variable to the data collection module!
RSIValue = RSI(Optimize("RSILength", 11, 6, 20, 1 ));

AFL "Optimize" section begin/end declaration
You can instruct AB_Prep to only seach for Input variables in a specific section by
surrounding your section with all the Optimize functions with the "//BTWF_START" and "//BTWF_END" comments:
RSILength = Optimize("RSILength", 11, 6, 20, 1 );
OverSold = Optimize( "OverSold", 20, 5, 40, 5);
OverBought = Optimize( "OverBought", 70, 60, 90, 5 );

AFL single bo.Backtest(True) declaration
Note that AmiBroker permits only ONE instance of the
"bo.Backtest(True)" function,
so when the scanner already detects this instructions above the data collection section,
it will automatically turn the default instruction in the data collection section into a comment with the line reference:
if (Status("action") == actionPortfolio )
    bo = GetBacktesterObject();
    // bo.Backtest(1); // already called at Line#783

Stratregy Input Parameter Synchronization from BTWFMgr to AFL file
Added AmiBroker AFL synchronization - using the #include_once function:
a) Right-click on the permutation and select "Synchronize Strategy Parameter"

b) BTWFMgr will export all parameter for this permutation to a new AFL file,
which is included after the last "Optimize()" statement or //BTWF_END command:
#INCLUDE_ONCE "C:/Program Files/AmiBroker/Formulas/Systems/" 
//Inserting Parameter Values for Perm#747

c) A new AFL file is created with the exported values for the selected permutation (
//BTWFMgr strategy permutation parameter section for Permutation#747

RSILength = 14; //Input#001
OverSold = 15; //Input#002
OverBought = 90; //Input#003


d) A confirmation box appears:



Import SPY 15Min test Data

We have also supplied a sample SPY 15Min intraday data series (SPY15MIN.TXT)
Copy the sample SPY 15Min intra-day data series (SPY15MIN.TXT) to the main AmiBroker folder:
C:\Program Files\AmiBroker\SPY15MIN.TXT

To Import this file into AmiBroker:
a) Click on File/Import Wizard
b) Click on PICK FILES and select "C:\Program Files\AmiBroker\SPY15MIN.TXT".
c) Click NEXT
d) Adjust the settings as shown below:

e) Click on NEXT
f) If you would like you can save these import settings
g) Click on FINISH
h) You should see a new Symbol in the "Symbol" Tab: SPY15MIN

i) To see the intraday data use: View/Intraday/15 Min

Diagnostics/DateConversions in Data Collection Module
The new 1.4 version will show you the current date format used by AmiBroker (and the computer in general) in the log file - Example:

BT-AB |18:51:42.411b|Detecetd DateFormat: M/D/YYYY (Day=2, Month=1, Year=3)
The module will show you the fields were it detected the Day, Month and Year: (Day=2, Month=1, Year=3)

in the UK for example you would see:
BT-AB |18:54:39.886b|Detecetd DateFormat: DD/MM/YYYY (Day=1, Month=2, Year=3)
The module will show you the fields were it detected the Day, Month and Year: (Day=1, Month=2, Year=3)

This diagnostic logfile is at:
C:\BTWFMgr\logs\YYYYMMDD\PSS_AB.log   (YYYYMMDD = current date - 20110514 = May 14th, 2011)
Each new data collection sequence starts with:
INIT |11:44:14.968 |====== Opening C:/BTWFMgr/logs/20110514/PSS_AB.log ======
Each 100th trade/position AmiBroker sends to BTWFMgr is shown with the Pos: Marker:
BT-AB |18:51:42.412b|Pos#000001: Entry: $ 148.72 9/4/2007 1:00:00 PM (20070904130000) Exit: $ 135.06 2/15/2008 4:00:00 PM (0) Size= 67 Par= 6, 5, 60
BT-AB |18:51:43.387b|Pos#000101: Entry: $ 154.90 10/15/2007 11:45:00 AM (20071015114500) Exit: $ 154.37 10/17/2007 10:45:00 AM (0) Size= 60 Par= 7, 15, 60
BT-AB |18:51:43.670b|Pos#000201: Entry: $ 152.55 10/19/2007 10:30:00 AM (20071019103000) Exit: $ 150.15 10/22/2007 2:00:00 PM (0) Size= 62 Par= 6, 20, 60
The "Entry:" Shows the entry price "$ 148.72" and entry date and time as text received from AmiBroker "9/4/2007 1:00:00 PM"  and the converted numeric entry (20070904130000)
The "Exit:" Shows the entry price "$ 135.06" and entry date and time as text received from AmiBroker "2/15/2008 4PM"  and the converted numeric entry (20080215160000
The "Par=" entry shows the respective first 3 strategy input parameters (RSILength, OverSold/Bought)

When you pull up the plug in list (Tools/Plugins) you should see the 1.4 version:

Set the date format in Start/Control Panel/Clock, Language, and Region/Change the date, time or number format:
(Always select formats with slashes as delimiter! - never a minus)


Expected AmiBroker Settings
Make sure you have the "Time Stamp" set to "time of LAST tick inside bar":

And "Backtester Settings" as shown below (set Commission as you see fit):

Suggested Trade Settings:

Suggested Report Settings:

"Diamond Backtesting with Walk Forward Manager (BTWFMgr)" Main Page

  Copyright 2004-2011, Burkhard Eichberger, Professional Software Solutions
All Rights Reserved Worldwide.

Table,Column,Field,Record,Index,Query,External Data,Save As,merge,synchronize,explorer,
command,line,batch scipts, shareware