Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Trader opens position shown as "a" (marked as 'OPENING' in the Direction column) in some security (SQ in this case) then closes it "marked as "b" ( 'CLOSING' in the Direction column).
- 2. After he closes that position Running total becomes 0
- 3. I need to calculate Profit & Lost on "1", "2" as "Money Paid to open that position" minus "Money received to close that position". And do it for every pair of OPENING/CLOSING
- 4. Please note PnL needs to be calculated BETWEEN TWO Zeroes in the RunningTotal column. In the attached example as between rows id 1 and 7, then between 8 and 21 etc.
Add Comment
Please, Sign In to add comment