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

[amibroker] Re: Using Portfolio Backtester To Track Performance - Need Pyramiding



PureBytes Links

Trading Reference Links

kk2628: Yes the script generates a series of AFL buy/sell signals 
reflecting the buy and sell orders in an actual trade list file. I 
provided a sample output in my original posting. I am planning in 
the near future to modify it to aggregate multiple buy orders (for 
the same stock) into a single AFL buy signal placed on the day the 
first buy order was made and placed at a price equal to the average 
price of all buy orders in that stock before selling the entire 
position. It's a temporary workaround until pyramiding is 
implemented. I hope to post the script once i am done. Thanks for 
your interest.

Best regards,
g

--- In amibroker@xxxxxxxxxxxxxxx, "kk2628" <kk2628@xxxx> wrote:
> Hello,
> 
> This is a very interesting finding of using AB portfolio tester.
> 
> I am struggling to code it in AFL to do the opposite of pyramiding 
e.g. I
> bought 10 contracts initially then I sold 5 contracts when the 
price reach a
> 2 to 1 reward/risk ratio, then I sold another 3 when the price 
reach a 3 to
> 1 r/r ratio or hit the trailing stop then I sold the remaining 
when the
> price hit my trailing stop.
> 
> BTW, is it your script will generate a long list of the following 
based on
> number of trades you made ? If possible, would you mind to share 
the script
> ?
> 
> Buy=Buy OR (DateNum()==1031118 AND Name()=="URMP");
> Buysize= IIf(DateNum()==1031118 AND Name()=="URMP",6000,buysize);
> BuyPrice=IIf(DateNum()==1031118 AND Name()=="URMP",0.225,BuyPrice);
> 
> Tks
> KK
> 
> ----- Original Message -----
> From: "giggollo99" <giggollo@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, November 20, 2003 1:26 PM
> Subject: [amibroker] Using Portfolio Backtester To Track 
Performance - Need
> Pyramiding
> 
> 
> > One interesting way I have started using the new Portfolio
> > Backtester is to track my own live trading performance. Here's 
how:
> >
> > 1. Extract transactions list from my brokerage's "Transactions" 
page
> > 2. Write a small script to convert Transactions list into AFL
> > buy/sell signals...e.g.
> >
> > ...
> > Buy=Buy OR (DateNum()==1031118 AND Name()=="URMP");
> > Buysize= IIf(DateNum()==1031118 AND Name()=="URMP",6000,buysize);
> > BuyPrice=IIf(DateNum()==1031118 AND Name()
=="URMP",0.225,BuyPrice);
> > ...
> >
> > 4. Copy/Paste the AFL  code into AA window
> > 5. Add following line:
> >
> > PositionSize=Buysize*BuyPrice;
> >
> > 6. Run Portfolio Backtester
> >
> > and Voila!...i get a plethora of metrics telling me how well i am
> > doing, i get account equity curves, trade equity curves, i get 
trade
> > by trade P/L and MAE info and much more!...This is extremely 
useful
> > information to have if you are a discretionary (or semi-
> > discretionary trader). It is interesting to start looking at your
> > own discretionary trading as a system, because in the end it all
> > boils down to buy/sell signals and you can see what areas you 
need
> > to work on..Even if you are trading a system (or trying to :) ),
> > using this approach can provide valuable information regarding 
the
> > difference between perceived theoretical performance of your 
system
> > and actual measured performance. It can show you where your 
actual
> > results are deviating from the theoretical expectations.
> >
> > Through this post I also would like to draw attention to the fact
> > that implementing pyramiding is an essential step towards the
> > maturing of the portfolio backtester. Right now, for example,
> > Portfolio backtester gets the P/L wrong on some trades just 
because
> > pyramiding is not yet implemented. It retains the share size of 
the
> > first trade even if i bought the same security multiple times 
before
> > selling. I do not know of a way to get around this except to wait
> > patiently for pyramiding to be implemented (i am open to
> > suggestions?)
> >
> > I thank Tomasz for providing such a nice tool and continuing to
> > improve the product with great momentum. I am *really* looking
> > forward to seeing pyramiding implemented in the near future.
> >
> > Thanks and Best regards to all
> > g
> >
> >
> >
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > 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 
http://docs.yahoo.com/info/terms/
> >
> >
> >


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/