Adding SQN to Visualizer
Author: Ben_Zurich
Creation Date: 2/4/2013 9:23 AM
profile picture


Is it possible to add a custom made Performance Index to the Optimizer? I understand that there are many but my specific interest concerns the

System Quality Number (SQN)

a measurement from van Tharp.


What is SQN? From a discussion elsewhere:

"The only way to seriously qualify and optimize any system is through
its System Quality Number (SQN). I advice you to refer to Van Tharp
for reference on the subject.

Assuming a set of N trades (N>30 for being statistically significant),
SQN is defined as follow:

SQN= Squareroot(N) * Average (of the N Profit&Loss) / Std dev (of the
N Profit&Loss).

The large the N, the more trading opportunities you have.
The large the average P&L, the better you are obviously.
The smaller the Std dev (P&L), the more regular are your results and
the smaller are the drawdowns.

Note here that if you optimize for the largest SQN, you maximize in
fact the product N*average P&L and you minimize the Std dev (P&L) and
the drawdowns at the same time."
profile picture


SQN® and the System Quality Number® are registered trademarks of the Van Tharp Institute. Let's hear from Van K. Tharp first and see if written permission can be obtained from the IITM. Will keep you posted.
profile picture


Hi Ben,

No reply received in five days. While we may be reluctant to include the trademarked metric in the library, nothing and nobody can stop anybody from programming it for their own personal use.

For an example of calculating SQN in C#, log in to the Wiki with your Wiki account to download the attachment containing updated source code of Performance Visualizers library:

Home - MS123 Visualizers

Actually, the code contains four different versions of SQN as per Van K. Tharp's book "The Definitive Guide to Position Sizing". I encourage you to obtain a copy of the original book. Pricey but pretty thorough.
profile picture



thank you very much. Apparently there are many ways to calculate SQN.

Your four implementations all use risk as a parameter, whereas the formula given in my first post does not. I have seen in your code that risk is derived from the 'RiskStopLevel' of the position, which in my case is zero (I don't use it). So I have to implement the other formula.

profile picture


You're welcome. Van Tharp is heavily using R-Multiples in his formulas (SQN in particular), and have even replaced his well-known Expectancy formula with a new calculation for this reason. Your formula comes from a blog poster citing another forum member, while I can assure you that my formulas are authentic with regard to the original book that I was going through while coding them. Hopefully the formula modification isn't complex.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).