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();
}



Reply via email to