Using Backtester.MonthlyReturns[Backtester.MonthlyReturns.Count-1]), I can get the monthly return of the past month (July). How can I get the actual return of the current month (August)?
Rename
It's incomplete, this is not supported to avoid peeking.
If you add this method, this should work.
CODE:
public override void BacktestComplete() { int endBar = Backtester.EquityCurve.Count - 1; int month = Backtester.EquityCurve.DateTimes[endBar].Month; double endingEquity = Backtester.EquityCurve[endBar]; double endingEquityLastMonth = 1; for (int n = Backtester.EquityCurve.Count - 1; n >= 0; n--) { if (Backtester.EquityCurve.DateTimes[n].Month != month) { endingEquityLastMonth = Backtester.EquityCurve[n]; break; } } double currentMonthReturnPct = endingEquity / endingEquityLastMonth - 1; WriteToDebugLog("Current Month Return: " + currentMonthReturnPct.ToString("P2")); }
Thanks Cone and you are right. This can be calculated via the equity curve...
Your Response
Post
Edit Post
Login is required