Hello,
I wonder why the following is happening:
After the i-incremented for loop of my low-level CBT code (which I displayed as a template below), I summed up the
value of all positions that were still open at end of backtest (variable "Last_open_position_value").
This variable (which to my understanding still contains marginloan) should correspond with column "position value" of trade list output for open positions,
but it doesn´t.
I added it as metric via bo.addcustommetric ("Last_open_position_value", Last_open_position_value) in backtest report to check for deviation.
Could someone let me know why the differ? I can´t see the flaw in my code.
Thanks
Markus
SetCustomBacktestProc("");
if (Status("action") == actionPortfolio)
{
bo = GetBacktesterObject(); // Get backtester object
bo.PreProcess(); // Do pre-processing
for (i = 0; i < BarCount; i++) // Loop through all bars
{
for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i))
{ // Loop through all signals at this bar
. . . .
} // End of for loop over signals at this bar
bo.HandleStops(i); // Handle programmed stops at this bar
bo.UpdateStats(i, 1); // Update MAE/MFE stats for bar
bo.UpdateStats(i, 2); // Update stats at bar's end
} // End of for loop over bars