I have a strategy running from 01-01-2017 till today.
I would like to output the total net profit, gross profit and gross loss of the strategy on a daily basis (end of session) using the Print() function to the output window.
This way I can follow the development of the strategy instead of only seeing the result as per today. Most notably I'm interested in the pressure on the margin of my account due to eod unrealized losing positions along the way.
I have tried several methods in my print statement such as:
- Position.GetUnrealizedProfitLoss(PerformanceUnit.C urrency, Close[0])
- SystemPerformance.AllTrades.TradesPerformance.Gros sLoss
... but they do not show the correct eod data.
This can be easily checked by doing something I wanted to avoid in the first place, namely iterating through the strategy analyzer manually and adding one day to the backtesting period, checking the outcome of the total net profit, gross profit and gross loss for the first day, for the first two days, for the first three days etc. until today and then entering all these data into Excel.
Of course this would be too tedious and unrealistic for even longer back testing periods.
Is there a way this can nonetheless be achieved?
A simple sample line of code would be very much appreciated ;-)
Regards,
Vladja
Comment