Relative Strength Investing

Hello Friends of Amibroker,
i wanna test a Trading System with invest in the top 4 Stocks of the SP500 Universum with the highest relativ strength ranking.

so i have watchlist with all SP500 Stock Symbols and this is the criteria.

x1 = Close/ma(close135);

i wanna calculate this for all 500 stocks and the System should buy the 4 stocks with the higest ranking...

with Holding period of 3 month, and then buy the next 4 best stocks with the highest relative strength ranking.

is this possible?

and please can you help me with the Code.

thank for your help and spending time for my question.


@odin what you appear to be describing would be a rotational trading strategy. Search this forum as there are dozens of example codes for rotational strategies already posted. Also the official Knowledge Base has plenty of information as does the User Guide


thank you for help!

it works great!!