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

RE: [amibroker] TradeIt



PureBytes Links

Trading Reference Links




Follow 
up on this:
<FONT face=Arial color=#0000ff 
size=2> 
I may 
be all "wet" when it comes to my statement on fixing the timing of the signal 
generation - I'm still working on that.
<FONT 
face=Arial color=#0000ff size=2> 
<FONT face=Arial color=#0000ff 
size=2>d

  
  <FONT 
  face=Tahoma size=2>-----Original Message-----From: dingo 
  [mailto:dingo@xxxxxxxxxx] Sent: Tuesday, April 22, 2003 1:24 
  PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] 
  TradeIt
  <FONT face=Arial color=#0000ff 
  size=2>Actually, you can sorta do most of what you're 
  after:
  <FONT face=Arial color=#0000ff 
  size=2> 
  <FONT face=Arial color=#0000ff 
  size=2>Rather than do a backtest do an exploration. You'll need to experiment 
  with it some so you can see when you get the signals. For example if you 
  have your settings at delay = 1 Open and you run an exploration 
  then you get all buy/sell/short/cover signals on the day they occur (as if 
  delay = 0). This can be "fixed" by manipulating in code 
  the  trade delay and the prices to be used to mimic the 
  backtester.
  <FONT face=Arial color=#0000ff 
  size=2> 
  Once 
  you do that then the door is open as to what you can include in the 
  output:
  <FONT face=Arial color=#0000ff 
  size=2> 
  I've 
  been experimenting with some of Fred's code:
  <FONT face=Arial color=#0000ff 
  size=2>Filter=1;
   
  /*=== This section uses Tonetti's Equity 
  Calc To generate Stats  ===*/
   
  BIR      = 
  IIf(Status("BarInRange") > 0, 1, 0);
   
  BarEq    = 
  Equity(1);CurEq    = Equity();MaxEq    = 
  Highest(CurEq);LogEq    = log10(CurEq);
   
  dBuy     = Ref(  
  Buy,-1);dSell    = Ref( Sell,-1);dShort   = 
  Ref(Short,-1);dCover   = Ref(Cover,-1);LongProfit = 
  IIf(dSell,E - ValueWhen(dBuy,E),0);ShortProfit = 
  IIf(dCover,E-ValueWhen(dShort,E),0);TotTrdes = Cum(dSell OR 
  dCover);WinningTrades = Cum((LongProfit > 0) OR (ShortProfit 
  >0));PctWinners = WinningTrades / TotTrdes;
   
  CurDD    = IIf(BIR, 100 * 
  (MaxEq - CurEq) / MaxEq, 0);MaxDD    = 
  Highest(CurDD);CumDD    = Cum(CurDD);
   
  FirstBar = ValueWhen(ExRem(Buy OR Short, 
  0), Cum(1));LastBar  = LastValue(ValueWhen(Status("LastBarInRange") 
  > 0, Cum(1)));TotBars  = 
  LastValue(Cum(1));BarNo    = ValueWhen(BIR > 0, Cum(1) - 
  FirstBar + 1);NoBars   = LastValue(BarNo);
   
  Dates    = 
  DateNum();Days     = ValueWhen(BIR > 0, IIf(Dates 
  != Ref(Dates,-1), 1, 0));TotDays  = 
  Cum(Days);BPD      = BarNo / 
TotDays;
   
  CAR      = 
  ValueWhen(BIR > 0, 100 * ((CurEq / Ref(CurEq, -(BarNo - 1))) ^ (1 / (BarNo 
  / BPD / 252)) -1));Ann      = ValueWhen(BIR > 
  0, 100 * ((CurEq / Ref(CurEq, -(252 * BPD)) - 
  1)));MAR      = ValueWhen(BIR > 0, CAR / 
  MaxDD);UI       = ValueWhen(BIR > 0, 
  sqrt(CumDD / BarNo));UPI      = (CAR - 5.4) / 
  UI;TPI      = UPI / MaxDD;
   
  mm       = 
  LastValue(LinRegSlope(Ref(LogEq, -(TotBars - LastBar)), NoBars));
   
  BarsCum  = ValueWhen(BIR > 0, 
  Cum(BarNo));AvgBar   = LastValue(BarsCum) / 
  NoBars;SRDevSQ  = ValueWhen(BIR > 0, sqrt(Cum((BarNo - AvgBar) ^ 
  2)));ErrEq    = LastValue(StdErr(Ref(logEq, -(TotBars - 
  LastBar)), NoBars));KRatio   = ValueWhen(BIR > 0, mm * 
  SRDevSQ / ErrEq / sqrt(NoBars));
   
  TradeEq  = IIf(Sell, (BarEq - 
  ValueWhen(Buy, BarEq)) / ValueWhen(Buy, BarEq), 0) + IIf(Cover, (BarEq - 
  ValueWhen(Short, BarEq)) / ValueWhen (Short, BarEq), 
  0);PosEq    = Cum(IIf(TradeEq > 0, TradeEq, 
  0));NegEq    = Cum(IIf(TradeEq < 0, TradeEq, 
  0));PosTrade = Cum(TradeEq > 0);NegTrade = Cum(TradeEq < 
  0);AvgPos   = PosEq / PosTrade;AvgNeg   = NegEq / 
  NegTrade;PosPct   = PosTrade / (PosTrade + 
  NegTrade);Expect   = (1 + AvgPos / abs(AvgNeg)) * PosPct - 
  1;
   
  PF       = 
  CurEq/NoBars/MA(C,63);
   
  /*=== This section adds columns to the 
  Exploration === */
   
  <FONT face="Courier New" 
  size=1>AddColumn(Buy,"Buy",1.0);AddColumn(Sell,"Sell",1.0);AddColumn(Short,"Short",1.0);AddColumn(Cover,"Cover",1.0);AddColumn(O, 
  "Open",1.2);AddColumn(L, "Low",1.2);AddColumn(H, 
  "High",1.2);AddColumn(C, "Close",1.2);
   
  <FONT face="Courier New" 
  size=1>AddColumn(CurEq,"Equity",1.2);AddColumn(Car, 
  "Car",1.2);AddColumn(Ann, 
  "Ann%",1.2);AddColumn(-CurDD,"CDD%",1.2);AddColumn(-MaxDD,"MDD%",1.2);AddColumn(MAR,"MAR",1.2);AddColumn(UI, 
  "UI",1.2);AddColumn(UPI, "UPI",1.2);AddColumn(TPI, 
  "TPI",1.2);AddColumn(Expect, "Expect",1.2);AddColumn(KRatio, 
  "KRatio",1.2);AddColumn(100*PctWinners,"%Accur",1.2);AddColumn(TotTrdes,"# 
  Trdes",1.0);AddColumn(PF,"PF",1.4);
   
  /* 
  ===================================   the columns below are 
  reserved for    Optimized signal levels. There   
  are a total of 10 allowed. The    ones not used should have 
  the   word "Rsvd" as the col 
  heading=================================== 
  */AddColumn(SLevel,"SLevel",1.0);AddColumn(0,"Rsvd",1.0);AddColumn(0,"Rsvd",1.0);AddColumn(0,"Rsvd",1.0);AddColumn(0,"Rsvd",1.0);AddColumn(0,"Rsvd",1.0);AddColumn(0,"Rsvd",1.0);AddColumn(0,"Rsvd",1.0);AddColumn(0,"Rsvd",1.0);AddColumn(0,"Rsvd",1.0);
  
    
    <FONT 
    face=Tahoma size=2>-----Original Message-----From: Sidney Kaiser 
    [mailto:s9kaiser@xxxxxxxxxxx] Sent: Tuesday, April 22, 2003 11:51 
    AMTo: amibroker@xxxxxxxxxxxxxxxCc: tj@xxxxxxxxx; 
    com@xxxxxxxSubject: Re: [amibroker] 
    TradeItAt 08:26 AM 04/19/2003 -0700, you 
    wrote:>While we wait for TJ to design and code some portfolio 
    testing capability>for AB, has anyone tried some of the alternatives 
    such as TradeIt?>>Chris Kryza wrote TradeIt as a post 
    processor for AIQ trades two or three>years ago and I used it a few 
    times back then.  It accepts trade data in>CSV form so the 
    thought occurred to me that it might be possible to export>AB 
    backtest data and run TradeIt on that data.>>Before I spend a 
    bunch of time trying to get it to work I would like to>know if 
    someone has already looked at using TradeIt with AB trade 
    >data.  If so:>>1. did it work>>2. 
    how difficult was it to adapt it>>3. were the results worth 
    the effort involvedTradeIT  is not the worlds greatest 
    portfolio trader, just an available example that had possibilities for 
    adaptation to AA output.I dug into the adaptation issue some this 
    weekend.  The output from AA backtest can be rearranged to fit the 
    input fields of TradeIT with some help from an intermediate modification 
    in Excel.  Unfortunately there is one problem I have not been able 
    to overcome.  There is no information available from AA about price 
    or equity movement between trades.  This information is essential 
    to creating a comprehensive report from TradeIT.  (see TradeIT 
    sample file for data input fields)I believe Fred Tonetti also 
    mentioned this as serious deficiency in one of his previous posts about 
    the limitations of what he can calculate in his expanded equity 
    indicator.  You can't get there from here with the present 
    information coming out of AA.As a side issue, I am reminded once 
    again that I want to be able to specify additional calculated columns in 
    AA backtest display.  For example, I might want to include MAR = 
    CAR/MDD as a column or ( more complicated ) include data on max or min 
    excursions of various data columns as part of my AA results. It would 
    also be helpful to be able to specify which data columns are displayed 
    and specify their display order.  Finally, being able to optimize 
    based on something like UPI or MAR would save me time and improve 
    optimization results by offering alternatives to only optimizing on max 
    profit.Comments?SidAt this point I guess the best we can 
    hope for is to get TJ to read the TradeIT documentation for ideas on 
    features to incorporate in his proposed portfolio tester. 
    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. 
    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












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.