Rotational trading with alternate exit criteria

I like the rotational test capability of AB quite a lot, but, as usual for me, I would like to do a bit more. Can someone point me to an appropriate discussion of alternative exits for rotation trading. For example:

items = 50;
positions = 10;
SetBacktestMode( backtestRotational );
SetOption("MaxOpenPositions", positions);
SetOption("WorstRankHeld", items / 2);
SetPositionSize( 100 / positions, spsPercentOfEquity );
SetOption("AllowPositionShrinking", True );
PositionScore = 1000 + ROC(Close, 252);

Is straight sell position if the ROC() turns negative. Here are a couple of alternate exit rules Walter Deemer suggested and one of my own:

The fund falls below the S&P 500 (because you don't want to hold something that is underperforming the market itself).
The fund falls below the money market rate of return (because you don't want to hold something that is underperforming cash).
Or, fund falls below a fixed rate of return, like 10%. (Sell it if it ain't performing.)

I am sure that something like this has been covered before, so any pointers would be most welcome.

Happy Holidays,

1 Like

@BBands just to make sure I understand you are asking about suggestions for the strategy and not coding the ideas that you mentioned?

Other possible inputs into a rotational scoring to consider:
correlation - not wanting a portfolio with too many holdings highly correlated
volatility - may want to penalize securities that are too volatile for your tolerance
valuation - if portfolio is actual stocks, then could add a valuation filter to the scoring

No, I meant to ask about AFL coding techniques to get those ideas done, but I like your list a lot. If this thread gets going, maybe we should fork it, one for strategies and one for implementation ideas.

Happy, happy,


Ah, OK. Perhaps something like this to compare your relative performance's could be used to manipulate your final score. Eliminating securities that don't meet your filter criteria (as with many things in AmiBroker there are other ways of performing similar calculations, for example using SetForeign)

periods 	= 252;
SP500 		= Foreign( "$SPX", "C" );
SP500momo 	= ROC( SP500 , periods);

Score = IIf(ROC(C, periods)>SP500momo, 1000 + ROC(C, periods), 0);

So this might produce these types of calculations (on a list of sector ETF's for example)

Happy Holidays to you and every one of our AmiBroker friends!


Perfect. I get how to do that now. Thanks so much!

Happy holidays to all!