[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Value of all open positions in CBT



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "Markus Witzler" <funnybiz@xxx> 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
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/