Thanks Mike, CBT .. one of my projects to come
A ----- Original Message ----- From: "Mike" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, September 03, 2008 9:06 PM Subject: [amibroker] Re: Portfolio Equity - AB version 5.16 > Ara, > > The Equity() function is a single symbol "backtester in a box", > meaning that it will figure out all your positions (for the current > symbol only, ignoring all other symbols) at the point that it appears > in your code. > > The ~~~Equity symbol is a pseudo symbol generated as a result of a > backtest and includes the positions for the entire portfolio as > specified by the settings of the AA window. > > If you want to make reference to ~~~Equity in your code, you need to > generate it first. As such, your strategy logic cannot depend on > ~~~Equity or you end up with a chicken/egg problem. > > To achieve what you are trying to accomplish, you must write custom > backtester code in which you can, on a bar by bar basis, refer to the > Equity property of the backtester object to find the portfolio equity > at each bar. You would then use that value to calculate your position > size, on a bar by bar basis, and apply it to each of the signals for > that bar (i.e. set the PosSize property of each Signal object). > > Refer to "AmiBroker Custom Backtester Interface.pdf" in the Files > section of this group to learn how to write your own backtester code. > > Mike > > --- In [email protected], "Ara Kaloustian" <[EMAIL PROTECTED]> wrote: >> >> Having trouble with Portfolio Equity function >> >> The code below works OK if I use Equity(0,0); >> >> It does not work if I use Foreign("~~~Equity",C"); No trades are > detected. >> >> >> StartEquity = 100000; >> >> SetOption("InitialEquity", 100000); >> >> SetOption("MinShares",100); >> >> Max_Pos = 30; >> >> SetOption("MaxOpenPositions",Max_Pos); >> >> RoundLotSize = 10; >> >> PointValue = 1; >> >> // >> >> >> >> //Compute Positions and position size >> >> Port_Equity = Equity(0,0); // <<<< ==== > This works OK >> >> Port_Equity = Foreign("~~~EQUITY()","C"); // <<<< ==== > This does not work >> >> Positions_ = Port_Equity / 10000; >> >> Positions = IIf(Positions_ > Max_pos,Max_pos,Positions_); >> >> SetPositionSize(Port_Equity/Positions,spsValue); >> >> >> >> Thanks >> >> >> >> Ara >> > > > > ------------------------------------ > > Please note that this group is for discussion between users only. > > To get support from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > For other support material please check also: > http://www.amibroker.com/support.html > Yahoo! Groups Links > > >
