How to successfully retrieve “walk-forward” report programmatically

0 votes
asked Jun 18, 2017 in AFL Code Wizard by Parsons Hsu

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 ); 

____________________________________________________________________________________________

1 Answer

0 votes
answered Jun 18, 2017 by admin (9,260 points)
You probably are overwriting same file multiple times. Using fopen( filename, "a" ) - in append mode, would give you possibility to see if that is the problem.

Note also that for AFL programming questions it is better to use http://forum.amibroker.com
commented Jun 20, 2017 by Parsons
Hello Sir
It seems that you misunderstand what I talking about.
The problem is not
"overwriting same file multiple times. Using fopen( filename, "a" ) - in append mode"

In short, I just what to know that "How I can export WALK-FORWARDING REPORT " by AFL.  

TKS for your help =)
...