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

RE: [amibroker] Re: Backtest using equity curve



PureBytes Links

Trading Reference Links




<FONT 
size=2>[quanttrader714] ...Well, when you figure out 
how to do that would you please post your methodology so I can give it a 
spin?
<FONT face=Arial color=#0000ff 
size=2> 
As I wrote, I 
haven't worked on this lately, so i can't give you finished/working code. You 
would have to score Long and Short trades independently, here is some code to 
get you started (based on ideas/code provided by TJ):


  LongPositionScore = <SPAN 
  class=020011805-16112003>Long<SPAN 
  class=020011805-16112003>FeedbackFunction( Foreign("~~~EQUITY", "O") 
  );
  ShortPositionScore = <SPAN 
  class=020011805-16112003>ShortFeedbackFunction( <FONT 
  size=2>Foreign("~~~EQUITY"<FONT 
  size=2>, "H") ); 
  
   
  LongPreferred = abs( LongPositionScore 
  ) > abs (ShortPositionScore );
  PositionScore = IIF( LongPreferred, 
  LongPositionScore, ShortPositionScore );
   
  Buy = Buy and 
  LongPreferred;
  Short = Short and NOT 
  LongPreferred;
You will have to 
write your own Long and Short feedback functions, the Foreign() calls retrieve 
the PortFolio Tester's separate Long and Short Equities that TJ already provides 
for us.  Ideas on what I think the feedback criteria should include were 
mentioned in my earlier email. 
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>herman
 

  <FONT face=Tahoma 
  size=2>-----Original Message-----From: quanttrader714 
  [mailto:quanttrader714@xxxxxxxxx]Sent: November 16, 2003 11:30 
  AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re: 
  Backtest using equity curveWell, when you figure out 
  how to do that would you please post yourmethodology so I can give it a 
  spin?  I'll keep an open mind but myinitial testing wasn't 
  promising.  And logically, it seems to me thatequity feedback is just 
  an application of the gambler's fallacy unlessserial dependencies exist 
  between your trades which is not the casefor mine.--- In 
  amibroker@xxxxxxxxxxxxxxx, "Herman vandenBergen" 
  <psytek@xxxx>wrote:> After reading my post below i realize 
  all this can be tested in thenew> Portfolio tester using 
  PositionScore, no longer a need to writeseparate> code as we used 
  to do :-) must try this soon.> > Thanks Tomasz! There are always 
  numerous new applications madepossible with> the new features you 
  introduce...> > herman.>   -----Original 
  Message----->   From: Herman vandenBergen 
  [mailto:psytek@xxxx]>   Sent: November 16, 2003 9:49 
  AM>   To: amibroker@xxxxxxxxxxxxxxx>   
  Subject: RE: [amibroker] Re: Backtest using equity curve> > 
  >   imho Equity feedback can only be expected to work in 
  short termtrading> systems, i.e. something like 1 to 5 day 
  trades.> >   It would make sense to use separate 
  equity curves for Long andShort> positions. The L&S composite 
  equity curve may go up while the Shortequity> curve is going down, 
  same for the Long side. The feedback equityarray> should be sampled 
  with the last trade of the same type, i.e. do notinclude> the last 
  Long trade period in the evaluation of the Short equity,this is> 
  essentially a Cash priod for the Short equity and carries noinformation 
  -> unless your system is perfectly symmetrical...> 
  >   herman.>     -----Original 
  Message----->     From: quanttrader714 
  [mailto:quanttrader714@xxxx]>     Sent: November 
  16, 2003 9:38 AM>     To: 
  amibroker@xxxxxxxxxxxxxxx>     Subject: [amibroker] 
  Re: Backtest using equity curve> > 
  >     I took a quick look at this a while ago and 
  wound up withsimilar>     findings.  For 
  the (good) systems I looked at, equity 
  feedback(only>     taking trades when equity is 
  above MA) hurt performance.  Then I>     
  looked at what would happen if only taking trades when equity 
  isbelow>     the MA and the results were even 
  worse.  At which point Idropped the>     
  study and didn't bother to look at mediocre systems or try 
  toconfirm>     the results with another 
  method.  Not saying this is 
  thedefinitive>     answer, but would love to 
  see quantitative evidence to thecontrary.> 
  >     --- In amibroker@xxxxxxxxxxxxxxx, 
  "giggollo99" <giggollo@xxxx>wrote:>     
  > Hi Herman, Glenn:>     
  >>     > I did some studies on this idea 
  about a year ago with futuresdata.>     > 
  For example, as Glenn suggested, "No new entries if a 
  closedtrade>     > crosses below a moving 
  average of the equity curve andre-enter>     
  when>     > a closed trade crosses above the 
  moving average."Interstingly I>     > found 
  one potential problem to be that you would miss out 
  onthe>     > winning trades that were 
  carrying the equity back over its MAand>     
  > would trigger you to start taking your system trades 
  again.Without>     > equity feedback, those 
  trades add to your bottomline and makea 
  big>     > difference i found. However, you are 
  always taking the tradesthat>     > take you 
  back under the equity curve. This is certainly 
  an>     > interesting approach and requires 
  further study perhaps withother>     > data 
  sets.>     >>     
  > Tomasz: Thanks a lot for the portfolio 
  backtester..its>     
  amazing..look>     > forward to seeing the 
  pyramiding feature implemented in 
  thefuture>     > 
  hopefully>     >>     
  > best regards to all>     > 
  g>     >>     
  >>     >>     
  >>     > using  and found that one 
  potential problem with using equitycurve>     
  > to start/stop your system>     
  >>     >>     
  >>     > --- In amibroker@xxxxxxxxxxxxxxx, 
  "Herman vandenBergen">     > <psytek@xxxx> 
  wrote:>     > > Metastock is a few years 
  behind me :-)>     > 
  >>     > > Yes it is great fun to create 
  combos; systems build up from>     > several 
  systems.>     > > You can use the signals 
  from a slow system to qualifysignals>     
  from>     > a 
  fast>     > > system (like a trend 
  qualifier). Or you can use the Longequity>     
  > from slow>     > > system one as a trend 
  indicator for system number two. Youcan>     
  > even pack a>     > > large number of 
  systems (perhaps including some 
  duplicatesystems>     > but 
  with>     > > different parameters) into one 
  piece of code and optimizefor the>     > 
  best>     > > signal combination from the lot 
  of them. When you separateLong>     > and 
  Short>     > > equities they can become trend 
  indicators for the systemunder>     > test, 
  it>     > > uniquely reflects the trend 
  sensitivities for the system,much>     > 
  better then a>     > > totally unrelated 
  trend indicator... imho>     > 
  >>     > > Unlimited possibilities, aren't 
  you glad you boughtAmiBroker :-)>     > 
  >>     > > 
  herman>     > >   -----Original 
  Message----->     > >   From: Glenn 
  [mailto:glennokb@xxxx]>     > >   
  Sent: November 12, 2003 3:10 PM>     > 
  >   To: amibroker@xxxxxxxxxxxxxxx>     
  > >   Subject: [amibroker] Re: Backtest using equity 
  curve>     > 
  >>     > >>     
  > >   Hi Herman,>     > 
  >>     > >   Thanks for your 
  reply. Excellent!>     > 
  >>     > >   Have you done much 
  testing with your equity curve tochange 
  your>     > >   systems 
  parameters?>     > 
  >>     > >   I've done most of 
  my backtesting with Metastock andTradesim>     
  and>     > been>     
  > >   waiting for ages for Tradesim to have this in 
  it.>     > >>     
  > >   Ami has been able to do it all 
  along!>     > 
  >>     > >   Cheers 
  Glenn>     > 
  >>     > >   --- In 
  amibroker@xxxxxxxxxxxxxxx, "Herman 
  vandenBergen">     > 
  <psytek@xxxx>>     > >   
  wrote:>     > >   > You can 
  cascade as many systems as you like, 
  evendifferent>     > 
  ones,>     > >   and 
  use>     > >   > the Equity from 
  the previous one as a parameter in thenext>     
  > system.>     > >   I 
  know>     > >   > this can be 
  done with the old backtester and think 
  itshould>     > 
  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 
  asneeded>     
  (afl>     > >   
  executes>     > >   > line after 
  line and never looks back), the 
  lastdefinition>     > 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 toincorporate 
  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 
  amoving>     > >   average 
  of>     > >   >   the 
  equity curve and re-enter when a closed 
  tradecrosses>     > 
  above>     > >   
  the>     > >   >   
  moving average. Another idea is to use a percentageon 
  the>     > 
  equity>     > >   
  curve>     > >   >   
  instead of a moving average.>     > 
  >   >>     > >   
  >   b. Using the above also test tightening the 
  actualtrailing>     > 
  stop>     > >   on 
  the>     > >   >   
  open trades. ie: if a closed trade crosses below 
  amoving>     > 
  average>     > >   
  (or>     > >   >   
  whatever) then instead of using a 3 x ATR stop thenuse a 
  2>     > x ATR>     
  > >   stop>     > 
  >   >   on the open 
  trades.>     > >   
  >>     > >   >   
  Note that the trades in between the exit and entryneed 
  to>     be>     > 
  >   tracked for>     > 
  >   >   the 
  re-entry.>     > >   
  >>     > >   >   If 
  this is possible, do you know how to set it 
  upplease?>     > >   
  >>     > >   >   
  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! 
  Termsof>     > Service.> > 
  > >     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 ofService.> > 
  >         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 
  ofService.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 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT











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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.