Rotational trading query

Hi,

I have recently purchased your licensed version of Amibroker. And I'm now well equipped with most of frequently used Amibroker syntax and also built in functions.

When I started learning Amibroker, I started with writing codes on single stocks based on buy sell conditions on indicator values. Then after becoming somewhat proficient in this type of coding, I moved on to learning rotational trading using your built in functions of position score and enable rotational trading.

But moving to a advanced level of rotational trading, I want now to create a rotational system wherein

  1. Out of the original watchlist of 500 stocks, I shall filter top 60 ranks based on 150 weeks Chande Momentum Oscillator(CMO) value.

2.This top 60 ranked stocks will become my new watchlist and new filter based on 100 weeks Chande Momentum Oscillator(CMO) value will screen top ranked 40 stocks

3.This screened top ranked 40 stocks will become my watchlist for further filter of top ranked 20 stocks based on 52 weeks Chande Momentum Oscillator(CMO) value.

4.These top ranked 20 stocks would be my initial portfolio stocks.

The exit of stock would be crossdown of EMA 2 weeks and 25 weeks for that particular stock. When this stock gets exited, again the above screening criteria is run and the replacement of this exited stock would be the top most rank of the 20 screened stocks but not in current portfolio of 19 stocks.

I need this system to be backtested, with position size of 5% of initial equity, and maximum 20 positions in portfolio.

I came across blogs wherein you have given some codes to create ranking without using position score variable; with the use of staticvargenerateranks but the code to rank based on staticvargenerateranks is too complex to understand without any documentation of the basics behind these statvar functions especially for non programmers like me, or without more codes written by Amibroker team for users using these statvar ranking functions.

Please help me write above code, and also help me provide any reference material to understand the way to writing these statvar ranking codes.

Regards,
Vijay

@vijayrawat welcome to the the forum. AmiBroker is a powerful piece of software with many capabilities and will require a lot of work and study to learn. Good luck.

Try the user guide,
https://www.amibroker.com/guide/afl/staticvargenerateranks.html

And search this forum for many more examples,
https://forum.amibroker.com/search?q=staticvargenerateranks%20

Once you have learned enough to make attempts at coding, if you need help come back and post your code and ask specific questions about what you are having difficulty with.

1 Like