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

[amibroker] Re: Pivots, Pivots, Pivots........



PureBytes Links

Trading Reference Links




Hello,
 
One correction. Portfolio equity is definitelly NOT the sum of 
individual backtest equities in general case.
This is so because in portfolio mode some trades can be 
dropped due to insufficient funds.
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Herman vandenBergen 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, January 26, 2004 2:16 
  PM
  Subject: RE: [amibroker] Re: Backtest 
  using equity curve
  
  <FONT face=Arial color=#0000ff 
  size=2>A single Backtest of a single stock's equity is Equity(0) 
  or Equity(1), see Help for more on the 0 and 1 
  arguments.
  <FONT face=Arial color=#0000ff 
  size=2>If you Backtest a series of stocks the equity() will take on a 
  different value for each new stock that is processed. These equities can be 
  summed using an AddToComposite(). This is more or less what happens when you 
  use the portfolio tester and you can access the final portfolio equities using 
  Foreign(), like with this code (originating from TJ I think) that shows how to 
  retrieve the Portfolio Equity. The "~~~EQUITY" composite is created by the 
  portfolio backtest:
  // TJ's Equity 
  Plotseq = Foreign<FONT 
  size=2>("~~~EQUITY", 
  "C");cash = 
  Foreign(<FONT 
  color=#ff00ff size=2>"~~~EQUITY", <FONT 
  color=#ff00ff size=2>"L");dr = eq - <FONT 
  color=#0000ff size=2>Highest(eq);bslh = <FONT 
  color=#0000ff size=2>HighestBars<FONT 
  size=2>(eq);GraphZOrder=1<FONT 
  size=2>;Plot(eq, 
  "Portfolio Equity", 
  colorBlue, styleLine );<FONT face="Microsoft Sans Serif" 
  color=#008000 size=2>//Plot(cash, "Cash", 
  colorGreen, styleArea );Plot<FONT 
  size=2>(dr, "Drawdown", 
  colorDarkRed, styleArea );<FONT color=#0000ff 
  size=2>Plot( <FONT color=#0000ff 
  size=2>Foreign(<FONT color=#ff00ff 
  size=2>"~~~EQUITY", <FONT color=#ff00ff 
  size=2>"O"), "Long 
  only", colorGreen );<FONT color=#0000ff 
  size=2>Plot( <FONT color=#0000ff 
  size=2>Foreign(<FONT color=#ff00ff 
  size=2>"~~~EQUITY", <FONT color=#ff00ff 
  size=2>"H"), "Short 
  only", colorRed );<FONT 
  face="Microsoft Sans Serif" color=#008000 size=2>//<FONT color=#008000 
  size=2>Plot(bslh, "#bars since last high", colorDarkYellow, styleLine | 
  styleOwnScale, 0, 10 * LastValue( Highest( bslh ) ) );<FONT 
  size=2>islastbar = Status<FONT 
  size=2>("lastbarintest"<FONT 
  size=2>);isfirstbar = Status<FONT 
  size=2>("firstbarintest"<FONT 
  size=2>);bar = BarIndex<FONT 
  size=2>();firstbar = <FONT color=#0000ff 
  size=2>LastValue( <FONT color=#0000ff 
  size=2>ValueWhen( isfirstbar, bar ) );lastbar = 
  LastValue( <FONT 
  color=#0000ff size=2>ValueWhen( islastbar, bar ) );al 
  = LastValue( 
  ValueWhen( islastbar, 
  LinRegSlope( eq, Lastbar 
  - firstbar ) ) );bl = <FONT color=#0000ff 
  size=2>LastValue( <FONT color=#0000ff 
  size=2>ValueWhen( islastbar, <FONT color=#0000ff 
  size=2>LinRegIntercept( eq, Lastbar - firstbar ) ) 
  );Lr = al * ( BarIndex<FONT 
  size=2>() - firstbar ) + bl;Lr = <FONT color=#0000ff 
  size=2>IIf( bar >= firstbar AND bar <= lastbar , Lr, 
  Null );<FONT face="Microsoft Sans Serif" color=#008000 
  size=2>//Plot( Lr , "Linear Reg", colorRed, 
  styleThick );
  
    <FONT face=Tahoma 
    size=2>-----Original Message-----From: paultsho 
    [mailto:paultsho@xxxxxxxxxxxx]Sent: January 26, 2004 6:14 
    PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
    Re: Backtest using equity curveI've seen many 
    clever use of equityMy question in regard to the system below is Is 
    E1 the equity of just one stock, or the whole portfolio in backtesting. 
    and if I want to use the equity curve of the whole portfolio, do i have 
    to use the addtocomposite function instead of E1=equity(1);thanks in 
    advance./Paul.--- In amibroker@xxxxxxxxxxxxxxx, "Herman 
    vandenBergen" <psytek@xxxx> wrote:> You can cascade as many 
    systems as you like, even different ones, and use> the Equity 
    from the previous one as a parameter in the next system. I know> 
    this can be done with the old backtester and think it should also work 
    in> the new PF tester.> > // system one code 
    here> E1 = Equity(1);> > // System two code 
    here> Buy = Buy and (some function of E1);> E2 = 
    Equity(1);> > // System three code here> Buy = Buy and 
    (some function of E2);> E3 = Equity(1);> etc.> > 
    You essentially redefine the buy signal as often as needed (afl 
    executes> line after line and never looks back), the last 
    definition will be what> determines your results.> 
    > Herman> >   -----Original 
    Message----->   From: Glenn 
    [mailto:glennokb@xxxx]>   Sent: November 12, 2003 1:35 
    PM>   To: amibroker@xxxxxxxxxxxxxxx>   
    Subject: [amibroker] Backtest using equity curve> > 
    >   Hi,> >   I'm was wondering if 
    it is possible in AB to incorporate the equity curve>   
    of a system within a backtest, using it to test the following:> 
    >   a. No new entries if a closed trade crosses below a 
    moving average of>   the equity curve and re-enter when 
    a closed trade crosses above the>   moving average. 
    Another idea is to use a percentage on the equity 
    curve>   instead of a moving average.> 
    >   b. Using the above also test tightening the actual 
    trailing stop on the>   open trades. ie: if a closed 
    trade crosses below a moving average (or>   whatever) 
    then instead of using a 3 x ATR stop then use a 2 x ATR 
    stop>   on the open trades.> >   
    Note that the trades in between the exit and entry need to be tracked 
    for>   the re-entry.> >   If this 
    is possible, do you know how to set it up please?> 
    >   Cheers, Glenn> > 
    >         Yahoo! Groups 
    Sponsor>               
    ADVERTISEMENT> > > > >   Send 
    BUG REPORTS to bugs@xxxx>   Send SUGGESTIONS to 
    suggest@xxxx>   
    ----------------------------------------->   Post 
    AmiQuote-related messages ONLY to: 
    amiquote@xxxxxxxxxxxxxxx>   (Web page: <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)>   
    -------------------------------------------->   Check group 
    FAQ at:> <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html> 
    >   Your use of Yahoo! Groups is subject to the Yahoo! 
    Terms of Service.Send BUG REPORTS to 
    bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    
    
    Yahoo! Groups Links
    
      To visit your group on the web, go to:<A 
      href="">http://groups.yahoo.com/group/amibroker/  

      To unsubscribe from this group, send an email to:<A 
      href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

      Your use of Yahoo! Groups is subject to the <A 
      href="">Yahoo! Terms of Service. 
    Send BUG REPORTS to 
  bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  
  
  Yahoo! Groups Links
  
    To visit your group on the web, go to:<A 
    href="">http://groups.yahoo.com/group/amibroker/  

    To unsubscribe from this group, send an email to:<A 
    href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
  


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html





Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.