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

[amibroker] Having trouble with AddToComposite/Custom metrics



PureBytes Links

Trading Reference Links

Can't fathom what I'm doing wrong, I'd be grateful for any help.

I normally have indices UKX-FTSE & DJI in my portfolio.
FTSE is open 08:00-16:30, DJI from 14:30-21:00.
When I tried to add 2 composites (one for each index) to use as a custom metric,
the FTSE composite contained numbers for the hours DJI is open & 0 for the bars between 08:00-14:25.

I then created a database with only the FTSE in it & got the same result,
despite having deleted & re-created the composites.

I realise composites are synchronized with the bars of the instrument they're built from.
I can't understand why the FTSE-only database still appears to "see" the DJI when it's not there.
I'm running 5.24 beta
The test code is:
StaticVarSetText("CompositeName", "~~BackTest" + Name());
AddToComposite(Ref(MACD(12, 26), -1), StaticVarGet("CompositeName"), "O", 
               atcFlagResetValues+atcFlagEnableInBacktest+atcFlagEnableInPortfolio+atcFlagEnableInIndicator);

MyVariable = Foreign(StaticVarGet("CompositeName"), "O");
printf("\n\nMy Var=" + WriteVal(MyVariable));

Buy = TimeNum() == 100000;
Sell = TimeNum() == 101500;
Short = TimeNum() == 153000;
Cover = TimeNum() == 160000;

SetCustomBacktestProc("");

if (Status("action") == actionPortfolio)
{
bo = GetBacktesterObject();
bo.Backtest(1);
dt = DateTime();
Column1 = Foreign("~~BackTest" + Name(), "O");
for (trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade())
{
 BOentrybar = LastValue(ValueWhen(dt == trade.EntryDateTime, BarIndex()));
 trade.AddCustomMetric("MACD", Column1[BOentrybar]);
}
bo.ListTrades();
}





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

**** 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:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto: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/