Retrieve “walk-forward” report programmatically?

Dear all:

Is there anyone ever successfully retrieve “walk-forward” report programmatically?

After reading manuals, I come up with the following code intending to retrieve “walk-forward” report programmatically.

However, I keep getting regular back-test report. Any advice?

Since I need to get many “walk-forward” reports for different commodities, I cannot do it manually.

Thanks in advance.

A sample “walk-forward” report attached as follow .image

(If there is no picture , you can click link : http://imgur.com/b03lCaW)

// My (failed) code for retrieving “walk-forward” report programmatically

//Create Folder
posFolder = "C:\\DataExport";
fmkdir(posFolder);

bo = GetBacktesterObject();

bo.Backtest();    // Run backtests
st = bo.GetPerformanceStats(0);
filename = posFolder+"\\PosData_"+StrFormat("%6.0f_%6.0f",Now(3)+1900*10000,Now(4))+".csv";


fh = fopen( filename, "w");
qs = StrFormat( "%g, %g, %g\n",st.GetValue("NetProfit") ,st.GetValue("Maxsystemdrawdown"),st.GetValue("NetProfitPercent") );
    fputs( qs, fh );
    fclose( fh ); 

I think the most optimal approach is to utilize the batch function in which you can find the Export Walk Forward command ( 6.19 ). Additionally, it seems that you want to export this report for many symbols - thus you can write a script that dynamically creates the batch XML for each of the symbol ( in order to avoid overriding one and the same file ). i.e:

  1. Open Project for symbol A
  2. Run Walk Forward
  3. Export WF result to file A.csv
  4. Open Project for symbol B
  5. Run Walk Forward
  6. Export WF result to file B.csv

Hope it heps.

2 Likes

Tks for your help in advance.
However, I just need output only part of the field.
I have tried this way , but it output all of the report.
I just need : [ Mode , Begin , End , Netprofit , and optimized parameters ]

How can I do it ?

Tks =)

I do not think you can select components from that report as it is fixed. In general, why would you ? You have all the fields and it’s up to you to pick and analyze the ones you want.
As a matter of fact - the option to include the Mode, Begin, End, Netprofit would be considerably more difficult than the option I recommended ( and very far from your code example ) - though possible. A good starting point for that is the code that exports each trade from the WF run posted on AB yahoo by @fxshrat.
You would need to aggregate the trade constituents from each run to generate the NetProfit metric.

Then export the report with all fields, open excel, delete the ones you want to delete and that’s that.

If you want only some fields, you need to remove unneeded ones from resulting file by post-processing of your own. Post processing can be done using script (like external JScript). Google for “Windows scripting host” to find out more.

yap!
Another queision is :
If I have 1000 shares in my watch list and I want output my "walk-forwarding report " individually.
How can I set my batch to do that?

This is my setting of batch now.

But this setting only could output a share.
How could I set it to output moreover shares individually?

Tks for everyone =)

You can add one by one the whole sequence ( setSymbol + the actions you want to do ) to the batch or generate a human readable XML ( batch - .abb ) somewhere else ( i.e. Excel or whatever ) ‘programmatically’ for each of the component.