- ago
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)?
0
300
Solved
3 Replies

Reply

Bookmark

Sort
- ago
#1
It's incomplete, this is not supported to avoid peeking.
0
Cone8
 ( 27.64% )
- ago
#2
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"));          }

1
Best Answer
- ago
#3
Thanks Cone and you are right. This can be calculated via the equity curve...
1

Reply

Bookmark

Sort