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

gain / loss from trades on last bar?



PureBytes Links

Trading Reference Links


Hi Tomasz and all,
 
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:
 
<FONT 
size=2>                              
original test         same test 
with open position closed out on last bar
<FONT 
size=2>                              
----------------         
----------------------------------------------------------------------
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, ifyou 
pay points, you may get more realistic results if you enter 
only half your true commision in the settings, in order to 
compensate.