Hi

From the manual

• “All trade variables listed above are only valid inside a TMF or a in trade enumeration loop. Otherwise they require ThisTrade to be set to a valid TRADE* pointer by script. This switches all trade variables to that trade.

I want to get access to the trade variables in a loop like this

static TRADE* Tr[6];
Tr[0] = NULL;
Tr[1] = NULL;
Tr[2] = NULL;
Tr[3] = NULL;
Tr[4] = NULL;
Tr[5] = NULL;

int N=0;
while(asset(loop(
"SPY",
"SMH",
"EMM",
"XLY",
"XLF",
"XBI",
0))) {
…….

ThisTrade = Tr[N];

……….

Tr[N] = enterLong();

……..
exitTrade(ThisTrade);
Tr[N] = 0;
}

I want to switch the trade variables to the asset traded, and get variables like TradeIsOpen, TradePriceOpen, TradeBarClose etc, Is this the right way to do that?

I tried but found those variables don't switch, why?

Thank you