Errata When Sorting on Signal Name
Author: swuzy
Creation Date: 7/9/2008 11:09 AM
profile picture

swuzy

#1
WL 4.X sorts the Signal Name correctly
WL 5.X does NOT sort the Signal Name correctly.

Some Strategies generate and rank a lot of Alerts.
For example the 33 Liner might rank some symbols as 23.74 and some symbols as 32.733, 33.733, 18.XX, etc.
When sorted, it goes:

9.xxxxx
8.xxxx
7.xxxx
6.xxxx
5.xxxx
4.xxxx
33.733
32.733
3.xxxx
23.74
2.xxx
18.xx
1.xxx

Reviewing a long list, it can be rather surprising and disconcerting.

Someone who is not aware of this aspect might just pick the 9.Xs and 8.Xs, and ignore the 33.Xx and others higher than 9.x

Of course one can copy and paste to a spreadsheet and resort with correct results.

Hopefully this will be fixed eventually in WL 5.Y


profile picture

swuzy

#2
Also, another oddity. Occasionally in the middle of a group of positive numbered Signal Names, there will be a negative number.

For example ...

7.075...
7.012...
-6.958..
6.86....
6.825...

I would hope that the negative numbers get sorted into the negative number grouping.

profile picture

Cone

#3
My guess is that this is a string sort (signal names are string) so it's correct - it's just not what you want when the "strings" happen to be "numbers".

Please create a Support Ticket (or call Fidelity Support) and we'll put it in the hopper for consideration.
profile picture

fundtimer

#4
My guess is that this is a string sort (signal names are string) so it's correct

Not exactly. As strings, a correct (example) string sort would be...
CODE:
Please log in to see this code.


...which is also what he wanted.
profile picture

swuzy

#5
OK, I've created a support ticket with a link to this discussion. Thanks.
profile picture

swuzy

#6
Another more frightening thought.

Would the version 5 sorting method affect backtesting and send to order symbol selection?

When backtesting in Portfolio Simulation Mode, the Strategy using these Signal Names is to apply the priority ranking (instead of a random choice among larger numbers of Alerts) to choose high ranking symbols until your available equity is used up. Would the backtests choose a 9 over a 33, or choose a -9 over an 8? Same concern about Send to Order.

Hopefully not and hoping that the Strategy selection will be done on a separate internal logic for sorting and ranking sorts to select and send to backtest and order processing, different from the presentation view logic of sorts in the Alert window. Otherwise we are in much bigger trouble with version 5.
profile picture

Cone

#7
QUOTE:
Would the version 5 sorting method affect backtesting and send to order symbol selection?


Of course not. The sort in the Trades view is an embedded function in the listview control. It's not even part of the Wealth-Lab client programming. Version 5 is different from 4x because the components are .NET and the other is Delphi.

When you have a cash limitation for trading signals on a bar, Version 5 is truly random, whereas Version 4x and prior was actually "pseudo-random" since it actually depended on the symbol's letters.

Anyway, Monte Carlo-Lab is recommended to see many more possibilities than what just a single simulation can give. Too many people get wrapped up on the results of a single simulation and think it's gospel when in reality one simulation occurring the way it did is just "luck" and is highly unlikely to ever be repeated in real life.
profile picture

Eugene

#8
QUOTE:
The sort in the Trades view is an embedded function in the listview control.


It looks like that a new Trades "view" (performance visualizer) - with modified sorting method according to swuzy and with a separate Priority column requested by redliontrader HERE - would do the trick?
profile picture

Eugene

#9
Well... after some time and a couple of .NET ListView sorter controls... got that PV in alpha.

Here's how it would look like:
http://i37.tinypic.com/o05gyh.png

It's going to duplicate the existing Trades view but will have a separate sortable column Priority - as seen on the screenshot, it already ranks by priority the old fashioned way. If no Position.Priority was specified then it will take WL5's default truly random priority and just display it. I feel it's going to be more convenient than to code a double (priority) to string (signal name) and then implement 'smart' content-aware sorting in the Signal Name column (which would sense what's in there: a double or a regular signal name).

Will finish it when I have time and then include it in Community Performance Visualizers Pack.
profile picture

Eugene

#10
The performance visualizer with the correctly sortable Priority column is completed and available as a part of Community Performance Visualizers Pack:
Trades view with Priority

At the moment it isn't that helpful because it was compiled against WLP/WLD 5.1 assemblies. Hope 5.1 is out soon. However there are open sources for those who are familiar with compiling in Visual Studio.