It appears that the use of a composite index, from whatever source -- in this case the zScore, of a group of ETFs, can indicate, in general, when it's time to be in or out of the market. Taken as a general indicator, the zMean in the algo seems fairly useful for risk on / risk off type determination.
Boosting the leverage boosts the returns as well as boosting the drawdowns, effectively doubling the volatility, as would be expected. Setting Leverage to 2.0 also boost the Sharpe though; I wonder why?
The use of an entry unit is also a point worth noting. The zScore ranked securities are purchased in linear ratio fashion with the highest percent given to the highest zScored security. The entry unit ensures that maximum leverage is never exceeded.
As an aside, adding back in pandas series items, as determined from open positions, took me forever to figure out. I call-out this code as it was a personal triumph (limited though it may be). It allows the open positions to join the best zScores as part of the next entry loop.
My dislike for Python is slowly ebbing...
zScores0 = zScores[topCount:] # best
zScoresX = zScores[:topCount] # worst
--- snip ---
openPositions = [stock for stock in context.portfolio.positions if context.portfolio.positions[stock].amount != 0.0]
lowZExisting = zScoresX[[stock in openPositions for stock in zScoresX.index]]
zScores0 = lowZExisting.append(zScores0)
[You'll have to excuse the bloated UpdateState method. I neglected to trim that down from another strategy. Apologies.]