[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Computing and plotting historical portfolio metrics in CBT


  • Date: Mon, 23 Nov 2009 16:45:22 +0100
  • From: "Markus Witzler" <funnybiz@xxxxxx>
  • Subject: [amibroker] Re: Computing and plotting historical portfolio metrics in CBT

PureBytes Links

Trading Reference Links



Hi Mike,
 
do you have a clue for me?
 
Thanks
 
Markus
----- Original Message -----
Sent: Sunday, November 22, 2009 12:16 PM
Subject: Re: [amibroker] Re: Computing and plotting historical portfolio metrics in CBT

Hello again, Mike!
 
Nope, I wanted to code my_equity to get a grasp of how CBT actually works.
 
I´m aware that my_equity is the same as ~~~Equity. I later want to modify my code to test my systems with different versions of my_equity, for instance
 
my_equity = cash position plus profit of all open positions (locked up by a stop).
 
I gues Van Tharp calls this "reduced total equity". I want to explore how testing results change if I change the definition of my_equity.
 
But again, I first need to know where the flaw in my code is. Otherwhise, I have no chance to proceed any further.
 
Thanks
 
Markus
 
 
 
 
----- Original Message -----
From: Mike
Sent: Sunday, November 22, 2009 6:52 AM
Subject: [amibroker] Re: Computing and plotting historical portfolio metrics in CBT

 

Markus,

If all you want is a copy of the ~~~Equity that AmiBroker already calculates for you, then there is no need to do any specialized signal/trade handling.

Just do the following:

SetCustombacktestProc("");

if (Status("action") == actionPortfolio
) {
   bo =
GetBacktesterObject
();
   bo.Backtest();
   
AddToComposite(Foreign("~~~Equity", "C"), "~my_equity", "X", atcFlagDefaults | atcFlagEnableInPortfolio
);
}

Plot(Foreign("~my_equity", "C"), "My Equity", colorBlue, styleLine);

Mike


--- In amibroker@xxxxxxxxxps.com, "Markus Witzler" <funnybiz@xxx> wrote:
>
> Hello,
>
> I want to compute and plot my own equity (labeled my_equity).
>
> In the code below (I skkipped the signal part with buy and sell signal), I wonder why my_equity
>
> - is not being shown in backtester report
>
> - can´t be plotted
>
> - doesn´t show up in exploration
>
> Why is that? If you reauire the rest of the code, please let me know
>
> Thanks
>
> Markus
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
> ...<snip >...
>
> for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())
>
> {
>
> trade = bo.findopenpos (sig.symbol);
>
> if (trade)
>
> {
>
> value_all_open_pos=value_all_open_pos + trade.GetPrice(i, "C") * trade.shares;
>
> }
>
>
>
> }
>
> bo.HandleStops(i); // Process programmed stops or applystop at this bar
>
> my_equity [i] = bo.cash + value_all_open_pos;
>
> } // End of for loop over signals at this bar
>
>
> bo.UpdateStats(i, 1); // Update MAE/MFE stats for bar
>
> bo.UpdateStats(i, 2); // Update stats at bar's end
>
> } // End of for loop over bars
>
> bo.PostProcess(); // Do post-processing
>
> AddToComposite(my_equity, "~~~my_equity","x", atcFlagEnableInPortfolio | atcFlagDefaults);
>
> }
>
> PlotForeign("~~~my_equity", "my_equity", colorRed, styleHistogram );
>



__________ Information from ESET Smart Security, version of virus signature database 4627 (20091121) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__________ Information from ESET Smart Security, version of virus signature database 4627 (20091121) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__._,_.___


**** IMPORTANT PLEASE READ ****
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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___