Database name/location in the backtest results

After running various backtests across several databases I went back to compare and review a few specific tests. When looking at the settings page/tab in the backtest reports I could not seem to determine which database was in use during the backtest. I also looked in the report explorer with no luck.

Am I just missing the database name or location saved somewhere in past reports?

Thanks,
Jim

You can get info about DataBase name by adding SetFormulaName() to your backtest code.

E.g.

formula_name = StrFormat( "MyFormulaName_%s", GetDatabaseName() );
SetFormulaName( formula_name ); 

// some dummy system code
m = MA( Close, 20 );
Buy = Cross( Close, m ); 
Sell = Cross( m, Close ); 
Short = Cover = 0;

Then info about used data base will be available in Report Explorer's second column

5

as well as at top of backtest report.

6

3 Likes

fxshrat,
Thanks for the quick and helpful info!

Jim

SetFormulaName( StrFormat( StrExtract( StrExtract( GetFormulaPath(), -1, '\\' ), -2, '.' ) + "-%s", GetDatabaseName() ) );

Above is what I use, all in one and dynamic, get's the alf file name and db name automatically.

@mdwin01,

Since you quoted me...

What you have there to get formula name is nothing new and has been posted on old Yahoo forum years ago already... precisely here.

So for better visibility

function GetFormulaName()
{  
	/// by T.Janeczko
	/// @link https://groups.yahoo.com/neo/groups/amibroker/conversations/messages/186489
	return StrExtract( StrExtract( GetFormulaPath(), -1, '\\' ), -2, '.' );
}

formula_name = StrFormat( "%s_%s", GetFormulaName(), GetDatabaseName() );
SetFormulaName( formula_name ); 

// some dummy system code
m = MA( Close, 20 );
Buy = Cross( Close, m ); 
Sell = Cross( m, Close ); 
Short = Cover = 0;
2 Likes

Nice! Thanks @mdwin01, @fxshrat