Click or drag to resize
TABLE

This topic contains the following sections:

TABLE is a variable which accepts a list of objects. It shows a row for each object in the list. Properties of objects are shown as columns.

TABLE is rendered using a grid widget. It has sorting, filtering, grouping and other features.

Sorting

Sorting is probably the most used action. Just click on the column header to sort data up. Next click will sort data down and next click will remove sorting.

Multiple columns can be sorted by shift-clicking on the 2-n columns or selecting Sort from the menu.

When sorting using the menus, the sorts are additive. So if you have one column sorted and you pick another sort from a column menu, it will add on to the existing sort rather than replacing it. You need to use the 'remove sort' option on the existing column if you don't want to sort by it any more.

When sorting using the headers, clicking on a header removes all other sorts unless you shift-click.

Try the following code:

C#
TABLE = from trade in C2TRADES
        where trade.SystemId == 46106678
          select new {Symbol = trade.Symbol,
                    Profit = trade.Result,
                    Direction = trade.Action == "BTO" ? "LONG" : "SHORT",
                    Quant = trade.ClosedQuant,
                    Entry = trade.EntryTime,
                    Exit = trade.ExitTime
                    };

 

Select Sort in columns: Symbol, Direction and Profit then:

Sorting
table sorting

 

 

Filtering

A data in the grid can be filtered.

Try the following code:

C#
TABLE = from trade in C2TRADES
        where trade.SystemId == 46106678
          select new {Symbol = trade.Symbol,
                    Profit = trade.Result,
                    Direction = trade.Action == "BTO" ? "LONG" : "SHORT",
                    Quant = trade.ClosedQuant,
                    Entry = trade.EntryTime,
                    Exit = trade.ExitTime
                    };

 

Numerical fields have two entry fields for filters. The first filed uses the greater or equal than expression, the second filter uses the less or equal than expression

Textual columns have one filed. It uses the contains expression.

Example: Enter zero to the first field in the Profit column, enter 500 to the second field and the text lo to the field in the Direction column.

You will see only LONG profitable trades having profits less or equal to 500:

Filters
table filters

 

 

Grouping

We want to see trading results per symbol.

We will use a data produced by the following code. It selects trades of some trading system. Run it.

C#
TABLE = from trade in C2TRADES
        where trade.SystemId == 46106678
        select new {Symbol = trade.Symbol,
                    Profit = trade.Result,
                    Action = trade.Action,
                    Quant = trade.ClosedQuant,
                    Entry = trade.EntryTime,
                    Exit = trade.ExitTime
                    };

Code
table code 01

Data
table code 01 result full

 

Columns have a drop-down icons for menus. Click on the drop down icon in the Symbol column. Select Group in the menu:

Symbol column menu
table code 01 result group symbol menu

 

Rows are grouped by symbols now. You can see how many rows are in each group:

Grouped by symbol
table code 01 result group symbol grouped

 

Click on the drop down icon in the Profit column. Select Sum in the menu:

Profit column menu
table code 01 result group symbol profit menu

 

Voilà! We have sums of trades profits for each symbol:

Totals per symbol
table code 01 result group per symbol totals

 

Interested in details? No problem. Click the plus icon on the left:

Totals per symbol unfolded
table code 01 result group per symbol totals unfolded

 

 

Multiple groups

Perhaps you want to see trading results grouped by symbols and separated by the trading direction (LONG/SHORT positions).

Run following code.

C#
TABLE = from trade in C2TRADES
        where trade.SystemId == 46106678
          select new {Symbol = trade.Symbol,
            Profit = trade.Result,
            Direction = trade.Action == "BTO" ? "LONG" : "SHORT", // Make a direction clearer
            Quant = trade.ClosedQuant,
            Entry = trade.EntryTime,
            Exit = trade.ExitTime
            };

Data
table code 02 result full

 

Click on the drop down icon in the Symbol column and select Group in the menu. The same in the Direction column:

Symbol column menu
table code 02 result group action menu

 

Rows are grouped by symbols and directions:

Grouped by Symbol and Direction
table code 02 result group direction grouped
Grouped by Symbol and Direction - unfolded
table code 02 result group direction grouped unfolded

 

Click on the drop down icon in the Profit column. Select Sum in the menu:

Profit column menu
table code 02 result group profit menu

 

Done! We have sums of trades profits for each symbol and trading direction:

Totals by Symbol and Direction
table code 02 result group direction profit

 

 

Export

There is a menu at the top-right grid corner. Use it to download data in the CSV format.

Grid menu
table grid menu