Thanks jcl, I've tried that before too.

I did following: If((NumOpenTotal+NumPendingTotal)<5 ...

And it works in terms of having not more than 5 open trades.
However, it has unintended consequences. As an example:

Fill = 3;

while(asset(loop("SPX500","US30","NAS100")))
{
Entry = -.008*priceClose();
LifeTime=5;
if((NumOpenTotal+NumPendingTotal)<2) enterLong();
}


If I write the code as above a trade in NAS100 will never be entered as at least 2 pending trades were already entered for SPX500 and US30 (regardless of whether SPX500 and US30 fulfill their entry condition the following bar).

However, that's not what I want. I want to enter 3 pending order but only open maximum 2 trades.

How can that be achieved? I could not find a way with Fill=3.

Thank you.