I am backtesting with 1-minute data and trying to calculate a custom backtest
metric after switching to the daily timeframe.
The BarCount does not change after the time frame change, so most of the bars
in the equity array do not contain valid equity data while in Daily time frame.
What is the right way to determine the first and last valid values in the
array?
if (Status("action") == actionPortfolio)
{
bo = GetBacktesterObject();
bo.Backtest(); // run default backtest procedure
st = bo.GetPerformanceStats(0); // get stats for all trades
_Trace("Name="+Name()+" Interval="+Interval(2)+" BarCount="+BarCount);
TimeFrameSet(inDaily); // Subsequent calculations are for DAILY results
_Trace("Name="+Name()+" Interval="+Interval(2)+" BarCount="+BarCount);
metric = calculate a custom single number using only the valid subset of the
Equity array
}
Trace Output:
Name=~~~EQUITY Interval=1-minute BarCount=1.05875e+006
Name=~~~EQUITY Interval=Daily BarCount=1.05875e+006