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

Re: gain / loss from trades on last bar?



PureBytes Links

Trading Reference Links

Hi,

I don'y know if it is a answer for you BBUT,
Tomasz must compute the gain with:
Capital* (exitPrc/entryPrc)-2*cost-capital
( I have done a verification on the trade report)

for me ( and perhaps others)I prefer to compute the gain with
(capital-cost)* (exitPrc/entryPrc)- cost - capital

it is a small difference, but it can explain some difference in last 
bar results.

stephane



> I was backtesting a system. I decided that I wanted to close out 
any open position on the last bar of the test so that total profit 
and other report statistics would reflect the most current status. 
So I added the following "OR" condition to my sell and cover 
statements:
> 
> sell /cover = (original condition) OR Ref(Cum(1),1) == LastValue
(Cum(1));
> 
> (Since the system trades on a 1 day delay, I had to trigger the 
signal on the next-to-last bar by looking forward 1 bar)
> 
> Now the backtester closes out my position on the final day, but 
the gain/loss from that final trade is not reflected in many of the 
items on the report.
> Here is one example:
> 
> original test same test with 
open position closed out on last bar
> ---------------- ------------
----------------------------------------------------------
> open position -270 0 
($270 difference)
> total net profit -2534 -2544 (only 
$10 difference)
> 
> The $10 difference in total profit is because I had my commisions 
set to $10 per trade, so this is the commision for the additional 
trade on the last bar. When I changed my commision to $5 per trade 
to test it, the difference changed to $5. Did I find a bug, or is it 
because of the way I did this? Do you know of any workaround? Thank 
you!
> 
> Steve
> 
> PS - I noticed one other thing that I havent seen anyone mention 
yet, and I thought it might be useful to mention for people that pay 
points for commisions. The system I was testing is a reversal system 
(always in the market). So if I am long, it sells and then goes 
short at the same time. If I am short, it covers and buys at the 
same time. The backtester charges 2 commisions each time this 
happens, which makes sense because technically I am doing 2 trades, 
but I think that given this situation in real life, this could often 
be done for the price of one commision (i.e. - I am long 1000 
shares, I get a signal to reverse positions, so I put in one order 
to sell 2000 shares). I suppose it depends on how your broker 
operates - I believe that my broker, in this situation, would 
automatically sell my 1000 shares and then short another 1000. 
Anyway, I just thought people should be aware - in this type of 
system, if you pay points, you may get more realistic results if you 
enter only half your true commision in the settings, in order to 
compensate.