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); 
CHART = GetC2SYSTEM(90325773).TradesHistogram(20); 
CHART = GetC2SYSTEM(46106678).TradesHistogram(20,spline:true); 

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.

Let us know what you think about this product.

Thank you.


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.

Good trading!



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?



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>
void Add(IEnumerable<Object> categories, IEnumerable<Decimal> values);

/// <summary>
/// Adds data to the chart.
/// </summary>
/// <param name="categories">The categories.</param>
/// <param name="values">The values.</param>
void Add(IEnumerable<Object> categories, IEnumerable<Double> values);

/// <summary>
/// Adds data to the chart.
/// </summary>
/// <param name="categories">The categories.</param>
/// <param name="values">The values.</param>
void Add(IEnumerable<Object> categories, IEnumerable<Int64> values);

(Not included in the documentation yet.)


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

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

IColumnChart tradesChart2 = new ColumnChart("Random numbers", "Random", "Random");
foreach (int i in Enumerable.Range(10,10))
     tradesChart2.Add(i.ToString(), random.NextDouble());

CHART = tradesChart2;

// =======================
//       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))
  listOfNames.Add(String.Format("I = {0}",i));


CHART = tradesChart3;


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 :smile:)


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.