Hi hope someone can help
I wish to work out the profit and loss on my trades so i can test my strategies
In simple terms i have the following table:
A,B,C,D
Date,price,signal,P/L
4/4/07,800,buy
5/4/07,810
6/4/07,815
7/7/07, 818
8/7/07, 816, sell, 16
9/7/07 ,810
10/7/07, 800
11/7/07 , 795, buy, 21
So i would like to have a formular which works out the P/L in column D
Column C can have either buy, sell , or be blank.
If a sihnal is generated the price is taken in column B and at some time in the future a opp signal will close the trade whereupon the calculation woukd work out the diff in the price taken initially say in the eg above on the 4/4/07 buy signal 800 would be used as the price and then this would be clossed on the 8/7/07 with the sell signal for a profit of 16 ie 816-800. At this point a new order is opened as well ie a sel at 816 which is clossed on the 11/7/07 at 795 for a profit of 21.
Each p/l calculation is seen as a pair of opp signals ie either buy closed by a sell signal or sell clossed by a buy signal. When the close signal is given it also opens a new order ie buy clossed by the opposite sell for p/l calculation opens new sell order which will be clossed in the future with the opp buy signal. which as well as clossing the trade opens a new buy order etc.
If a signal lets say buy is opened if on future days a blank cell or even another buy signal is generated then these are ignored as the trade can only be clossed be the oppsite order ie a sell order in this case.
hope someone can help
thank you
Bookmarks