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

[amibroker] Problem with Equity Plot - TJ



PureBytes Links

Trading Reference Links




I have noticed a problem with the way equity is plotted after 
a Back Test run. It seems that the equity plot starts moving away from the 
initial value only after the first buy or sell subsequent to the starting date 
of the test run, rather than at the start (with delay set to 0).  Here is 
the code for the equity line for a simple moving average cross-over trading 
system which I am running from 2/23/2001 to 
7/10/2003.-----------------------------------------------------------------------SetTradeDelays(0,0,0,0);ApplyStop(0,0,0,0); 
ApplyStop(1,0,0,0); 
ApplyStop(2,0,0,0);BuyPrice=SellPrice=ShortPrice=CoverPrice=C;
 
Buy = Cross(Close, (1 + 0.002)*EMA(Close, 40));Sell = 
Cross((1 - 0.002)*EMA(Close, 40), Close);
 
Short = Sell;  Cover = Buy;Buy  = 
ExRem(Buy,Sell); Sell = ExRem(Sell, Buy); Short = ExRem(Short, Cover); Cover 
= ExRem(Cover, Short);
 
/**///--equity-plot-- do not remove this 
lineMaxGraph=0;GraphXSpace=5;GraphZOrder=1;Plot( Equity( 0, -2 ), 
"Equity", 1, styleArea );
 
/* now buy and hold simulation 
*/Short=Cover=0;Buy=Status("firstbarintest");Sell=Status("lastbarintest");SetTradeDelays(0,0,0,0); 
PositionSize = 
-100;ApplyStop(0,0,0,0);ApplyStop(1,0,0,0);ApplyStop(2,0,0,0);Plot( 
Equity( 0, -2 ), "Buy&Hold", 
0);------------------------------------------------------------------------On 
the attached plot (sorry about using JPG, but I couldn't get the detail to show 
well enough in a PNG), the bottom panel shows the Equity Plot and the middle 
panel shows the trading code run in IB with arrows added to indicate the Buys 
and Sells. Note that with the test starting at the pole, 2/23/2001, which is a 
few days after a Sell, the Equity does not start following the price line until 
after the next subsequent signal, 37 days later on 4/18/2001. Also, the results 
window at the bottom of AA shows the Trade to be "Out" until 4/18/2001, at which 
time it goes to "Long."
 
I have made a fairly complicated work-around, but I am 
thinking that I must have something wrong; surely AB should start the 
equity calculation and plot right away. Any help or comment 
appreciated.
 
Bill






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.



Attachment:
Equity.jpg

Attachment: Description: "Description: JPEG image"