Hi Herman,
SetOption ( "allowsamebarexit", False );
Buy = Sell = 1;
Short = Cover = 0;
PositionSize = 10000;
SetCustomBacktestProc( "" );
if( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.Backtest( 1 );
e = bo.EquityArray();
for( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )
{
ExitDate = trade.ExitDateTime;
trade.AddCustomMetric( "Equity", Lookup( e, exitdate ) );
}
bo.ListTrades();
}
Hello,
I have a system where I would like to display the equity value returned by Equity() in the Backtester report.
While I can display any value it doesn't want to display the value returned by Equity(). How would I be able to do this? I copy my test code below.
Many thanks for your help!
Herman
SetCustomBacktestProc( "" );
if( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.Backtest();
PctBHProfit = StaticVarGet( "PctBHProfit" );
_TRACE( "Action BH: " + PctBHProfit );
bo.AddCustomMetric( "BH %Profit", PctBHProfit );
Test = StaticVarGet( "Test" );
_TRACE( "Test: " + Test );
bo.AddCustomMetric( "Test", Test );
}
Buy = Status( "firstbarinRange" );
Sell = Status( "LastbarInRange" );;
Short = Cover = 0;
BuyPrice = Open;
SellPrice = Close;
Eq = Equity();
InitialEquity = GetOption( "InitialEquity" );
PctBHProfit = ( Eq / InitialEquity - 1 ) * 100;
StaticVarSet( "PctBHProfit", PctBHProfit );
Test = 9999;
StaticVarSet( "Test", Test );
Attachment(s) from Aron Pipa | View attachments on the web
1 of 1 Photo(s)
Posted by: Aron Pipa <aron@myafl.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
EmoticonEmoticon