Histograms examples

Hello Collective2 members!

A purpose of this forum is to promote our Collective2 Explorer product and to stimulate a discussion about it.

I will try to show some Collective2 Explorer features here within next few days.

Today, I want to show histograms.

Histograms can help to answer a question how a strategy achieved its profit.

Did it make a few big trades or did it accumulate profits of many small trades?
Or perhaps: Did it lose its capital in one or two big losers or in many small trades?

I took two currently top popular strategies as examples.

I used this code:

``````CHART = GetC2SYSTEM(90325773).TradesHistogram(5);
HR();
HR();
``````

Numbers 90325773 and 46106678 are strategies IDs.
Numbers 5 and 20 are numbers of histogram bins.

What are histograms showing?
Trades profits are divided to the selected number of bins (shown on the X axis).
(Numbers on the X axis are values of right edges of the bins.)
Columns (Y axis) show counts of trades in each bin.

The first histogram has 5 bins:

The second histogram has 20 bins:

The third histogram includes a spline curve:

You can switch columns or the spline curve on and off. Just click on its label:

Do not hesitate and try it with any other strategy which you are interesting in!
Just use its ID in the GetC2SYSTEM command.

Thank you.

2 Likes

Hi @BobSvan2 this was a nice post. As you know Ascendant TY kind of collapsed since then. I wonder if you can find interesting data using Explorer that would have flagged major hidden risk in this system before it went south?

A histogram can contain info on hidden risk.

The lingo in statistics for the type of histogram that has hidden risk is a left-skew distribution. Itâ€™s a simplification, but basically a system with left-skew has a longer or fatter left tail on the histogram, which means occasional big losses and fewer big wins. The middle of the distribution often has many small wins and fewer losses (which looks good on an equity curve). But the thing that eventually can lose you money very quickly is the left tail risk.

By their nature certain trading strategies have a natural skew:

• Trend following is generally right-skewâ€“long tails on the right of the histogram.The trading pattern is many small losses and fewer large wins. Often risks with trend following systems are clear because you are always taking small losses, itâ€™s the upside that is rarer and more difficult to see as the surprises tend to happen on the upside. Systems that manage to be profitable with %win lower than 50% are generally right-skew and arenâ€™t as likely to have hidden risk. Most often average \$win will be much higher than average \$loss in these systems. C2 seems to have fewer of these systems, probably because they are safer but can appear less sexy to non-sophisticated traders. An example of this sort of system is Simple Swing (%win is 40%, average \$win is higher than average \$loss).

• Reversion to the mean trading is generally left-skewâ€“longer tails on the left of the histogram. The trading pattern is many small wins and fewer large losses. Equity curves on reversion systems can often look nice and smooth as there are constant smaller wins. Risks can be hidden however as surprises tend to happen to the downside. Most often average \$win will be lower than average \$loss in these systems. An example is Bob Dylan SP500 (%win is 78%, average \$loss is higher than avg \$win).

Left-skew systems are not bad, but you need to be aware that by their nature risks are more hidden and weighted to the downside. You need to watch for leverage increasing in left-skew systems as that lengthens the left tail and increases damage from rare losses. I warn against systems with a very high %win as they usually use a reversion system coupled with a martingale-like â€śadding to losersâ€ť to make that high percentage of profitable trades. The problem is this increase of leverage makes their long left tails even worseâ€“and one day their long hidden left tail arises to kill you.

So when you examine a system look at it carefully in terms of how it trades and where its skew is. If it has more profitable trades than loser trades and/or average trade \$loss is larger than average \$win, itâ€™s most likely left-skew. Examine its trading to make sure it doesnâ€™t add more and more leverage to tradesâ€¦ that tends to make the left tail longer and hides risk that can one day arise to crush you. On the other hand a right skew system that increases leverage (â€śadding to winnersâ€ť) is a good thingâ€“it increases the length of the right tail making surprise gains bigger.

My own system, Drunk Uncle, is primarily mean reversion and thus left-skew:

However I never add to a position so I do not lengthen the left tail and increase the damage from unexpected losses. It will sometimes reduce leverage in volatile markets (in contrast to increasing it), reducing damage from potential surprise losses. The system also has a trend following component which adds some right-skew. This balances the system and currently has my average \$win being slightly higher than my average \$loss.

5 Likes

Hi,

I wonder if you could open up the interface/implementation of the underlying chart (the display object, without the hard-coded trades)? In other words I would like to be able to produce a histogram with custom data. I am happy to set up the buckets myself, but if you have properties/method for those, so much the better.

[It is not documented, but] I could create an instance of a ColumnChart and I also could set its Data property to a List, it compiled and ran, but showed an empty chart. Obviously there are a few more properties I need to set, but instead of guessing maybe you can let us in?

TIA!

Joseph

The IColumnChart interface has following â€śAdd(IEnumerable<>â€¦)â€ť functions now.
You can use them to construct a chart from lists:

``````
/// <summary>
/// Adds data to the chart.
/// </summary>
/// <param name="categories">The categories.</param>
/// <param name="values">The values.</param>

/// <summary>
/// Adds data to the chart.
/// </summary>
/// <param name="categories">The categories.</param>
/// <param name="values">The values.</param>

/// <summary>
/// Adds data to the chart.
/// </summary>
/// <param name="categories">The categories.</param>
/// <param name="values">The values.</param>

``````

(Not included in the documentation yet.)

Examples:

``````// =======================
//       Example 1
// =======================
IColumnChart tradesChart1 = new ColumnChart("Hard coded numbers", "Number", "Number");

// =======================
//       Example 2
// =======================
Random random = new Random();

IColumnChart tradesChart2 = new ColumnChart("Random numbers", "Random", "Random");
foreach (int i in Enumerable.Range(10,10))
{
}

// =======================
//       Example 3
// =======================
IList<string> listOfNames = new List<string>();
IList<decimal> listOfValues = new List<decimal>();
IColumnChart tradesChart3 = new ColumnChart("Random numbers from lists", "Random", "Random");
foreach (int i in Enumerable.Range(10,10))
{
}

``````

Enjoy!

Thank you SO MUCH!

This looks WONDERFUL!

I donâ€™t have much time this week, but next week I sure will experiment with it (and get back to you with more demands )

Joseph

Thanks again.

There must be a copy/paste typo in the code because if I create a chart:

IColumnChart tradesChart2 = new ColumnChart(â€śRandom numbersâ€ť, â€śRandomâ€ť, â€śRandomâ€ť);

with not identical axis labels, I still get identical axis labels in the chart (the Y axis label.)

This is corrected now.
Thank you.