Hello,

This illustrates my point.  Equity for the current back tester is only 
available through Custom Backtest Interface.  I don't think is should be 
necessary to be an object oriented programmer to access something as 
fundamental as Equity.  [Or that ApplyStops don't update the Sell/Cover arrays 
without using Equity(1), which you cannot use with the current back tester.]

Is there no way in the current code to make Equity available?  If not, fine, 
I'll keep on doing what I'm doing, but it would sure be useful to get the long 
and short equity for previous bars.  Total Equity *is* accessible tangentially 
through SetPositionSize ( 100, spsPercentOfEquity ); - but I don't know if I 
could make that work.


Regards,

Joe

--- In [email protected], Tomasz Janeczko <gro...@...> wrote:
>
> Hello,
> 
> Equity is exposed, when it is available.
> In 1st phase you are collecting signals, not backtesting.
> Backtesting is done in phase 2 when all signals from all symbols are known.
> 
> You should read this
> http://www.amibroker.com/docs/Houston2.pdf
> 
> In phase 1, when you are collecting signals, you can access 
> single-symbol equity (for current symbol).
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> 
> On 2010-05-31 21:32, whitneybroach wrote:
> > "Why Equity (both long and short, symbol and portfolio) is not exposed 
> > during Backtesting outside of CBT is a mystery to me"
> >
> > Me, too.<g>   It would save a lot of CBT code.  The less code, the better.
> >
> > --- In [email protected], "j0etr4der"<j0etr4der@>  wrote:
> >    
> >> Hello Markus (and the others who replied),
> >>
> >> You need to review the Comments for the ApplyStop and Equity Help topics 
> >> to understand the dilemma you find yourself in.
> >>
> >> First, the Sell/Cover arrays are not filled by ApplyStop.  You need to use 
> >> Equity(1):
> >> "For visual conformation of ApplyStop function, add the following lines 
> >> below your ApplyStop formula in Indicator Builder:
> >> Equity(1); // THIS EVALUATES STOPS
> >>
> >> Plot(Sell==4,"ApplyStop Sell",colorRed,1|styleOwnScale);
> >> Plot(Cover==4,"ApplyStop Cover",colorGreen,1|styleOwnScale);"
> >>
> >> Second, you cannot use Equity() in back testing:
> >> "Equity() function is using OLD back tester that is missing some recently 
> >> added features such as multiple-currency handling and scaling in/out.
> >> New code should rather use new, portfolio-level back tester, i.e. 
> >> ~~~EQUITY special ticker."
> >>
> >> Third, you cannot use the ~~~EQUITY ticker in back testing, because it is 
> >> created by the back tester. If you want access to Equity during back 
> >> testing you must write a Custom Backtest Procedure.
> >> NOTE: Even that may be problematic if you wish to use InitialEquity with 
> >> Equity in Walk-forward Backtesting. (More on this below the sig.)
> >>
> >> To safely use Equity(1), segregate your Indicator or Exploration code from 
> >> back tester code:
> >> if ( Status( "action" ) == actionIndicator )
> >> {
> >>   Equity( 1 );
> >>
> >>   Plot( Sell == 3 ), "Sell(profit)", ColorBlack, StyleNoLine|StyleOwnScale 
> >> );
> >> }
> >>
> >> So, the answer is, you have to write your own stop functions if you need 
> >> to know the state of the trade; for example, in Buy/Short, or Sell/Cover>  
> >> 1. There is a simple (i.e., incomplete) example in "Back testing your 
> >> trading ideas" at "Coding your own custom stop types." I don't recall any 
> >> good stop code in the Library, but it's worth a look.
> >>
> >> Why Equity (both long and short, symbol and portfolio) is not exposed 
> >> during Backtesting outside of CBT is a mystery to me.  What's more 
> >> important than Equity??? (To be fair, Equity(0) was per symbol, not 
> >> portfolio, and so had limited usability for many AB users.)
> >>
> >> And why, after all this time and Equity() not being upgrade to the new 
> >> back tester since 2006, doesn't ApplyStop just update the Sell/Cover 
> >> arrays?
> >>
> >> Still, AB is by far the best tool available so we press forward.
> >>
> >>
> >> Best of luck,
> >>
> >> Joe
> >>
> >>
> >> Regarding using CBT to access Equity:
> >> Some time back I took a shot at an equity stop loss by plagiarizing some 
> >> code I'd found that did something similar. It appeared to work in normal 
> >> back testing, but when I ran it in WFO, it failed.  It appeared that 
> >> InitialEquity was being changed, which seems to matched up with the 
> >> description in Help for "Walk-forward testing and optimization." See, 
> >> "...scaled.." near the end. In February I sent the following code to 
> >> support asking about it, but never received a reply.
> >>
> >> SetCustomBacktestProc( "" );
> >>
> >> if ( Status( "action" ) == actionPortfolio )
> >> {
> >>
> >> bo = GetBacktesterObject();
> >>
> >> bo.PreProcess();
> >>
> >> for( bar = 0; bar<  BarCount; bar++ )
> >> {
> >> CurrentPortfolioEquity = bo.Equity;
> >>
> >> for( sig = bo.GetFirstSignal( bar ); sig; sig = bo.GetNextSignal( bar ) )
> >> {
> >> if( CurrentPortfolioEquity<  bo.InitialEquity * 0.90 ) sig.PosSize = 0;
> >> }
> >> bo.ProcessTradeSignals( bar );
> >> }
> >> bo.PostProcess();
> >> }
> >>
> >>
> >>
> >>
> >> --- In [email protected], "Markus Witzler"<funnybiz@>  wrote:
> >>      
> >>> Hello,
> >>>
> >>> I want to specify different appystop conditions for long and short 
> >>> posisions.
> >>>
> >>> How does AB recognize which one is for which trade?
> >>>
> >>> Thanks
> >>>
> >>> Markus
> >>>
> >>>
> >>>
> >>> __________ Information from ESET Smart Security, version of virus 
> >>> signature database 4668 (20091207) __________
> >>>
> >>> 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/
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
>


Reply via email to