Page 1 of 1

Ranking systems

Posted: Wed Dec 26, 2007 2:29 pm
by droskill
Hey all --

I've been looking for a piece of software that can combine some technical/indicator trading with the idea of ranking based on some criteria. I was chatting with someone on Nuclear Phynance and they suggested I ask here - so here's the question:

Say I want to buy stocks that are in the top 10% of a ranking (based on any criteria) - can I do this with Trading Blox? Would it be difficult?

Any help greatly appreciated,


Posted: Wed Dec 26, 2007 4:07 pm
by Tim Arnold
Yes, you can rank and sort all the markets based on any custom criteria. You can then enter positions in the top x% or top x markets, and exit those that are no longer on the list.

This requires some code in the Builder Edition -- a sample block to test this concept is available to customer free in the Blox Marketplace.

Posted: Thu Dec 27, 2007 12:26 pm
by droskill
thanks for the response - I reviewed the docs and see the feature/function.

Unrelated question: Is it possible to calculate a dataset or indicator across a group/portfolio of instruments. A classic example would be to calculate the number of stocks in an index above/below a 50-day moving average.

Help greatly appreciated!


Posted: Thu Dec 27, 2007 12:32 pm
by Tim Arnold
Yes, you can create the indicator to use, which is then computed for each instrument.

You can then loop over the instruments in a particular group and tally up the number that are above/below the average.

In Trading Blox you can set futures instruments to two separate groups, and stocks to the industry and sector.

You can also setup dynamically computed groups using the correlation function, to determine what set of markets are closely or loosely correlated. Some customers then loop over these markets to check for a percent above/below some indicator.

Posted: Thu Dec 27, 2007 1:20 pm
by droskill
Final question for today: do you suport Jurik indicators? (

Posted: Thu Dec 27, 2007 1:28 pm
by Tim Arnold
The current 2.2.6 version of Trading Blox does not support using the external dll Jurik indicators.

Posted: Fri Dec 28, 2007 4:33 pm
by droskill
So I downloaded the trial - I'm working on with it on the ranking stuff. Here's something that I don't quite get: I want the system to buy the top 5 of a portfolio - so no entry/exit rules - but if I don't use an entry/exit rule, I don't get any trades. Is there a simple way to accomplish this?



Posted: Fri Dec 28, 2007 6:26 pm
by sluggo
Hi /d/ , do you have working code for this trading method, written for some other platform? Tradestation, AmiBroker, Wealth-Lab, Recipes? If so could you post it here? A really great feature of software code is its lack of ambiguity; its "meaning" is plain and apparent, not subject to interpretation.

Posted: Sat Dec 29, 2007 9:42 am
by droskill
I have not tried to program this in any system - so I can't refer to code here, but let me try to be more specific:

- Rank all instruments by some ranking system - could be 6m performance or RSI or anything else.
- On the first day the system is run (in terms of backtest), buy the top N instruments based the ranking system.

Example: I've ranked ETFs by comparing 12m performance/returns. I buy the top 5 ETFs.

- Once per month (or week, or daily)
- Rerank the instruments.
- Sell instruments that have fallen out of the top N.
- Buy instruments that have risen into the top N.

Money management: simple strategy here - just divide equity by N (number of positions you want to carry). This will be the equity per position.

So as you can see - I'm not looking - at the moment - at using, say, a cross of a 50-100 SMAs to do entry or exit. But I do plan, after getting a ranking system going, to work with more traditional technical indicators to augment entry/exit.

Hopefully this is specific enough - any help greatly appreciated!

Posted: Sat Dec 29, 2007 10:11 am
by Tim Arnold
I would use instrument.SetLongRankingValue to set the ranking value to your custom strength computation in the Rank Instruments script of the Portfolio Manager.

Then the instruments will be sorted and the instrument.LongRank will have the correct rank value each day.

In the Entry script you can check if it is a new month, and then check the instrument.longRank and instrument.position to determine if you should buy/hold or sell the instrument.

The Money Manager should be fairly straightforward, as you have access to the test equity and can create an 'n' parameter.