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

[amibroker] Using CBI the first time



PureBytes Links

Trading Reference Links



Hello all,

I intend to create a proprietary formula for "My_total_equity" to able to modify it later on to suit to my individual needs.

Here, I_ use "Value of cash position (bo.cash) + value (all open positions by their close)" as a start.

When I run backtest, I get the following message:

"Com Variable not initialized or has invalid type" though I initialized "Value_open_positions=0" and also "My_total_equity=0;"

The loop to determine the aggregate value of all open positions goes like this:

for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())

{ // Loop through all open positions

Value_open_positions=Value_open_positions+ trade.getprice(i,"C")*trade.shares;

trade.addCustomMetric("Value of open positions", Value_open_positions);

} // End of for loop over trades at this bar

My_total_equity=bo.cash+Value_open_positions;

trade.AddCustomMetric("My total equity", My_total_equity);

Where is the mistake? If the whole code is required, please let me know.

Thanks

Markus



__._,_.___


**** 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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___