The composites created by "for loop" and "if else" or "switch()" are
different from the ones created by changing "nn" manually and scanning.
A "for loop" may be too fast for AddToComposite() and start creating
the next composite before the previous one is written.
How do I pause and sequentially create composites ?
for( nn = 0; nn < 3; nn++ )
{
if ( nn == 0 )
{
Buy = 0;
aa = Close;
AddToComposite( aa, "~ATCa", "X" );
}
else
if ( nn == 1 )
{
Buy = 0;
bb = Foreign( "~ATCa", "Close", 0 ) + Close;
AddToComposite( bb, "~ATCb", "X" );
}
else
if ( nn == 2 )
{
Buy = 0;
cc = Foreign( "~ATCb", "Close", 0 ) * Close;
AddToComposite( cc, "~ATCc", "X" );
}
}