Testing a system over multiple securities

Suppose I had a simple futures trading system, just buys and sells, no stops, something like a moving average crossover, and I had a list of 30 futures markets I wanted to test it on. It is obvious to me how to test it on a single market and how to test it as a portfolio using code like this.

// Portfolio parameters
NumPos = 30;
SetOption( "MaxOpenPositions", NumPos );
PositionSize = -100 / NumPos;

(In the above code, taken from this forum--thanks, why is position size a negative number?)

What if I wanted to test it over all 30 markets and see the results for each market, to determine the suitability of each market, as well as the aggregated results for all 30 markets, to get a sense of how it works in general? How would I do that?



By markets I guess you refer to future contracts.

Set Apply to setting to something other than Current such as Filter and choosing a Watchlist (number).

And instead of Portfolio backtest choose Individual backtest.

and e.g.

SetPositionSize(contracts = 1, spsShares);

That helps, thanks. "contracts = 1" does not seem to appear in the docs.

Am I using the correct doc source?




It is just custom variable. You can also write just

SetPositionSize(1, spsShares);

spsShares refers to shares and contracts.

BTW, you can set FuturesMode and other settings via SetOption too.

SetOption("FuturesMode", True);

So SetPositionSize(contracts = 1, spsShares); is an assignment inside a function call. I gather that the function then uses the variable 'contracts'. Correct?

Yes shares/contracts = units - the name does not matter. spsShares is just a constant with numerical value of 4 and it means that you declare position size in units whatever unit is.