Are you trying to show the total value combined of all open positions? If so, you should be setting your custom metric on the backtester object itself (i.e. bo.AddCustomMetric(...), rather than on the individual trades.
If you're trying to set it on the individual trades, then just set the value of that single trade (i.e. getPositionValue), not the values of all trades up to that point. Also, the backtest report, and thus the custom metrics, are as of the last day of the analysis period. So, the values you see will not be "for any given day". If you truely want "for any given day", then add the individual positon values to a composite and plot the composite. Mike --- In [email protected], "Markus Witzler" <funny...@...> wrote: > > Hello, > > I have trouble finding coming up with the proper code for determining the > value of all open positions for any given day (determined by the close!) > > Is it this: > > for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos()) > { > Value_open_positions = Value_open_positions + trade.GetPositionValue() > trade.AddCustomMetric ("Open Position Value", trade.Value_open_positions); > } > Incidentally, GetPositionValue doesn´t indicate if it uses closing prices. > > > > > > __________ Information from ESET Smart Security, version of virus signature > database 4581 (20091107) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com >
