A Ranking System takes a list of symbols and
assigns a value to each symbol within this list.
Generally, a symbol value
ranges from zero to 100.
To create a ranking system, open the ranking
system manager, Analysis->Ranking System Manager, click on the 'Add'
button and then type a name.
Now select the ranking system you have just
created and start adding formulas and nodes.
Add parent
node: Add a top node
Add node: Add a node within
the selected node
Add formula: Add a formula within the
selected node
Nodes and
formula have in common: the name and the weight properties.
Right click on a
node or formula to open a menu.
You can assign a different weight to each
node or formula to give them more or less importance.
Formulas have some others
properties:
- Formula: a rule or formula you want to use. The
red flag nears the formula input box and the circle in the tree view indicates
whether the formula is correct (green) or incorrect (red).
- Factor: multiply the formula result by the
provided value
- Description: the description of the formula
- Maximum and minimum levels: The maximum and
minimum value the formula can have, if a formula return 110 while the maximum
level is set to 100, then the application will use a value of 100.
Auto update factor: If this
item is checked, the application will decide which factor to apply to the
formula. The chosen value is not always accurate, so it is better to update the
'factor' field manually. Generally if the formula return values between 0 and
100, for example an indicator like the relative strength index (rsi), then a
factor of one should be used; if the formula return either zero or one (Ex :
close > 20), then a factor of 100 should be used.
Calculation
example:
Let us make some calculation using this above ranking system
as an example.
As you can see, this ranking system contains two nodes.
The
first node contains one node which contains two formulas.
The second node
contains one formula.
The calculation begins with the
formulas.
Formula: rsi (14)
Bars |
1 |
2 |
3 |
4 |
5 |
Values |
45 |
46 |
50 |
52 |
54 |
Formula: rsi (7)
Bars |
1 |
2 |
3 |
4 |
5 |
Values |
20 |
23 |
29 |
20 |
19 |
Formula: rsi (21)
Bars |
1 |
2 |
3 |
4 |
5 |
Values |
60 |
61 |
60 |
50 |
45 |
The values equals the rsi value
multiplied by the factor value of the formula, we took here a factor value of
one.
Now the software will calculate the parent node of theses
formulas.
For each bar, the software takes the value of each node's children
(formula or node), multiply it by the formula or node's weight, add all the
values, and then divide the result by the sum of the children's
weights.
For the bar number one and for the node 'Node1 – 1'
S = sum
of children's weights: 10 + 10 = 20
rsi(14) value = 45 * 10 =
450
rsi(7) value = 20 * 10 = 200
rsi(14) value + rsi(7) value = 450
+ 200 = 650
'Node 1 – 1' value = 650 / 20 = 32.5.
Node: Node1 -
1
Bars |
1 |
2 |
3 |
4 |
5 |
Values |
32.5 |
34.5 |
39.5 |
36 |
36.5 |
We make the same calculation for the
'Node2'.
Because the 'Node2' has only one child, it will get the same values
as its child.
Node: Node2
Bars |
1 |
2 |
3 |
4 |
5 |
Values |
60 |
61 |
60 |
50 |
45 |
Node: Node1 (same as Node1 –
1)
Bars |
1 |
2 |
3 |
4 |
5 |
Values |
32.5 |
34.5 |
39.5 |
36 |
36.5 |
Now, the software will calculate the 'Top
Node' (Ranking system values) which has two children (Node1 and Node2).
The
same calculation as described above applies.
Top Node = ((Node1 *
Node1_weight) + (Node2 * Node2_weight)) / (Node1_weight +
Node2_weight).
Therefore, for the first bar it will be:
Top Node bar1 =
((32.5 * 100) + (60 * 50)) / (100 + 50)
Top Node: (Ranking system values)
Bars |
1 |
2 |
3 |
4 |
5 |
Values |
41.67 |
43.33 |
46.33 |
40.67 |
39.33 |
NB:
If you want to ignore a node or
formula you can uncheck it, only checked nodes are
evaluated.
Select a node, right click on it and then
click on 'Add rules from list of rules'.
You just have to select a list of
rules then your ranking system will be populated with these rules.
To analyze or back-test a ranking system,
click on 'Analyze Ranking System'.
The 'Analyze Ranking System Settings' form
will appears, update settings then click on 'Analyze'.
The ranking system
analyzer settings are the same as in the 'Analyze List of Rules
Settings'.
However, there are two more fields:
·
Number of buckets: Let you
specify the number of buckets you want to create
Let us say, our ranking
system returns values from zero to 100, if we specify 10 as the number of
buckets, then the application will back-test or analyze ten systems.
The
first system will be the one that have values between 0 and 10, the next one
with values between ten and 20... (If you choose Normal Ranking as a Ranking
Calculation)
·
Ranking
calculation:
Same
number of positions in each bucket: The boundary between states
are choosen so that each state is assigned the same number of
positions.
Normal Ranking: The boundary between
states are choosen so all the states have the same size.
Example: number of
buckets = 10; bucket 1 will contains all the positions that have a rank between
zero and ten, bucket 2 will contains all the positions that have a rank between
ten and twenty and so on.
Ranking on each rebalance
date: For each rebalance period, calculate the values, sort
symbols by their value and assign a rank to each symbol (distance between the
ranks will be equal).
Example: For a specific date, we have four symbols with
the following ranks: 11, 10, 20, and 90; we first sort these symbols then assign
a new rank to each one, we will end up with the following new ranks: 0, 25, 50,
and 100, where symbol number one have a rank of 25, symbol number two have a
rank of 0 and so on.
(The trading system back-tester uses this type of
ranking)
- Rebalance every: The analyzer starts at the
start date and advance by a number of days as specified in this
field. For each period, a rebalance is done (old positions are
closed and new ones are taken).
Unlike the 'Rules Analyzer', which
rebalance or taking a new position occur only after the old position is
closed, the 'Ranking System Analyzer' takes new positions after a specific
number of days; this position is then assigned to a bucket depending on the
value of the ranking system at this date.
The 'Analyze Ranking System Report' contains
all the back-testing results related to your ranking system.
Instead of analyzing a ranking system,
you can also analyze each node of a ranking system separately; this will let you
know which nodes perform well.
To analyze ranking system nodes, select a
ranking system then click on 'Analyze Nodes'.
The 'Analyze Nodes Report' contains all the
back-testing results related to your ranking system nodes.
Each line
represents a node, as you can see in the picture below.
Click on the
charts to display additional back-testing information.
You can access a ranking system from the
QuantShare language by using this function:
Ranking("ranking system category", "ranking system name");
This function will return the ranking system
value of the current symbol. You can use it to create rules and then apply them
to the rules analyzer, ranking system analyzer (Ranking system based on another
ranking system), trading systems and prediction models...