Diamond Backtesting with Walk Forward Manager (BTWFMgr) EasyLanguage®
(Professional Software Solutions)

BTWFMgr allows you to easily add a small section to your strategy EasyLanguage® which will capture your backtesting data.
See the Code example below

1. Open Editor with your Strategy Code
A. Open TradeStation
Start/Programs/TradeStation 8.1 (Build XXX)
B. Open the strategy EasyLanguage Code
File/Open EasyLanguage Document (Ctrl+E)
C. Select "Strategy" in the Select Analysis type pull down list (at the top)
then click on your Strategy and click on the Open button (you might need to enter a password)
D. When the Strategy EasyLanguage window has opened
continue to Step2 below

 

2. Open the Diamond BTWFMgr
Start/Programs/Diamond Backtesting with Walk Forward Manager (BTWFMgr)/Backtesting with Walk Forward Manager (BTWFMgr)
3. Click on the "Strategy Preparation" button (or File/Strategy Preparation)
4. Strategy Preparation Box
Your Strategy name should appear in the Strategy box at the top.
Click on the Prepare button to load the strategy input list.
When you are ready click on the "Modify Strategy" button, so BTWFMgr can generate the modified EasyLanguage Code.


You can also use the clipboard to send BTWFMgr the EasyLangugage code:
a) Enter the strategy name into the "Strategy Name" box
b) Copy the entire Strategy Code to the Cluipboard (Select All + Copy)
c) Click on the "Load from Clipboard" button
d) Confirm the modification - click on YES

e) The Strategy Input parameter will appear
f) Click on "Modify Strategy"
g) The newly modified Strategy Code will appear in NOTEPAD - Copy and Paste the new text to the EasyLangugae Window.
5. To save overhead - select only the Strategy variables you will use in optimizations:
You see a list of all your Strategy Input variables.
All numeric variable - which can be used in backtesting optimizations - are pre-selected with an X in the "Optimize" column
To select/de-select a variable double click on that line - and the X will appear/disappear
6. The click on the Modify button
This will automatically add a small section at the end of your strategy and verify the strategy for you.
That's it - you are ready to go - click on the Confirmation box:
7. A new Strategy input parameter has been added: nBTWFMgrExport
The following modes are available:
0 Disable BTWFMgr data capture
1 Enable BTWFMgr data capture - in initial strategy potential research mode
When you are researching the basic strategy potential and the effect of additional context input values
2 (Default) Enable BTWFMgr data capture - in regular backtesting mode
When you are finalizing strategy development and want to collect data for the Walk Forward backtesting
8. When you initially develop your strategy you usually want to research the effect of additional context input values.
With BTWFMgr you can check now if certain ranges or values will improve the overall strategy result and then filter bad entries out!
We have added - as an example automatically - the TimeOfDay context value, so you can see of certain times yield better results.

This function allows you to add also these context input values to the BTWFMgr data capturing:
A. Add one line for each context variable before the line:
// WalkForwardVar = WalkForwardVar + "/YourContextVariables";
Here is one example - adding two angles:
   WalkForwardVar = WalkForwardVar + "/Angle1";
   WalkForwardVar = WalkForwardVar + "/Angle2";
B. Increment the specified input counter (X) by the number of added context values (X+added)::
     arrPSSBTVal[0] = 7; // add Number of Context Variables
Here is one example - if you had an input counter of 7 - adding two variables - will change it to -9:
     arrPSSBTVal[0] = 9; // add Number of Context Variables
C. Add the actual values to the BTWFMgr data capture function argument list, after the line:
     arrPSSBTInp[6] = Time; // Context Input#01
Here is one example - adding two angles (array is zero based):
       arrPSSBTInp[7] = Angle1; // Context Input#02
       arrPSSBTInp[8] = Angle2; // Context Input#03
D. Verify the EasyLanguage code and run your optimizations
E. When the BTWFMgr is showing the result - you will see your context variables in the "Context Variables" section
(red squares) in the BTWFMgr treeview on the left 

Example BTWFMgr added data collection segment:

//====== BTWFMGR_F2D83D3A_BBDB_447E_B0FE_209ED95E4E3F =============
//====== WALK-FORMWARD-OPTIMIZATION DATA COLLECTION SECTION ======
external: "PSS_BT.DLL", int, "PSS_BT", LPSTR,LPSTR,LPSTR,IEasyLanguageObject;
Vars: nRetWFO(0),WalkForwardVar(""),nMinMove(MinMove/pricescale);
Array: arrPSSBTInp[100](0), arrPSSBTVal[30](0);
if nBTWFMgrExport > 0 then begin
if nBTWFMgrExport = 3 AND Marketposition = 0 then
  Buy("L") 1818 shares next bar at market;
if GetAppInfo(aiOptimizing) = 1 then begin
  //------ Setup Input Name List
  if WalkForwardVar = "" then begin
    WalkForwardVar = "RSILength";
    WalkForwardVar = WalkForwardVar + "/OverSold";
    WalkForwardVar = WalkForwardVar + "/OverBought";
    WalkForwardVar = WalkForwardVar + "/EMALength";
    WalkForwardVar = WalkForwardVar + "/LossAmt";
    WalkForwardVar = WalkForwardVar + "/GainAmt";
    if nBTWFMgrExport = 1 OR nBTWFMgrExport = 3 then begin
      WalkForwardVar = WalkForwardVar + "/*TimeOfDay";
//    WalkForwardVar = WalkForwardVar + "/YourContextVariables";
  end;
end;

  //------ Transfer current Strategy Input Values
  arrPSSBTInp[0] = RSILength; // Strategy Input#01
  arrPSSBTInp[1] = OverSold; // Strategy Input#02
  arrPSSBTInp[2] = OverBought; // Strategy Input#03
  arrPSSBTInp[3] = EMALength; // Strategy Input#04
  arrPSSBTInp[4] = LossAmt; // Strategy Input#05
  arrPSSBTInp[5] = GainAmt; // Strategy Input#06
  arrPSSBTInp[6] = Time; // Context Input#01
  
  //------ Transfer Position Details
  arrPSSBTVal[0] = 6; // Number of tracked Strategy Inputs
  if nBTWFMgrExport = 1 OR (nBTWFMgrExport = 3 AND CurrentShares = 1818) then
    arrPSSBTVal[0] = 7; // add Number of Context Variables
  arrPSSBTVal[1] = (MarketPosition(0)*MaxShares(0));
  arrPSSBTVal[2] = (MarketPosition(1)*MaxShares(1));
  arrPSSBTVal[3] = EntryPrice(0);
  arrPSSBTVal[4] = EntryPrice(1);
  arrPSSBTVal[5] = ExitPrice(0);
  arrPSSBTVal[6] = ExitPrice(1);
  arrPSSBTVal[7] = PositionProfit(1);
  arrPSSBTVal[8] = Commission + Slippage;
  arrPSSBTVal[9] = nMinMove;
  arrPSSBTVal[10]= BigPointValue;
  if LastBarOnChart then
    arrPSSBTVal[11] = 1 // Last Bar reached
  else
    arrPSSBTVal[11] = 0;
  arrPSSBTVal[12] = BarNumber;
  arrPSSBTVal[13] = BarType;
  arrPSSBTVal[14] = BarInterval;
  arrPSSBTVal[15] = nBTWFMgrExport;
  arrPSSBTVal[16] = Date;
  arrPSSBTVal[17] = Time;
  arrPSSBTVal[18] = Open;
  arrPSSBTVal[19] = High;
  arrPSSBTVal[20] = Low;
  arrPSSBTVal[21] = Close;
  arrPSSBTVal[22] = Volume;
  arrPSSBTVal[23] = BarsSinceExit(1);
  arrPSSBTVal[24] = BarsSinceEntry(1);
  arrPSSBTVal[25] = MarketPosition*CurrentShares;
  
  //------ Call Diamond Backtesting Data Collection Interface
  nRetWFO = PSS_BT(Symbol,"PSS_RSISample"{Strategy},WalkForwardVar{InputNames},self);
end;
//------ Close new Positions in Potential Mode
If nBTWFMgrExport = 1 then begin
If marketposition = 1 then
  Sell ("LPot") next bar Market;
If marketposition = -1 then
  Buy to Cover ("Spot") next bar Market;
end;
end; // End of Data Collection Insert
//====== BTWFMGR_F2D83D3A_BBDB_447E_B0FE_209ED95E4E3F =============


© Copyright 1998-2006, Burkhard Eichberger, Professional Software Solutions
All Rights Reserved Worldwide.

 

DbTkXml,DbXml,Database,DBF,XML,Export,Import,SQL,MDB,XML,DTD,HTML,CSV,Access,Toolkit,
Table,Column,Field,Record,Index,Query,External Data,Save As,merge,synchronize,explorer,
Db2XML,Db2CSV,Db2Txt,Db2Html,DbLoad,DbExplorer,DbSql,DbQuery,DbScript,
Conversion,Automate,API,Windows,Microsoft,utilities,file,management,administration,
command,line,batch scipts, shareware