Van Tharp's SQN (system quality number) - futures io
futures io



Van Tharp's SQN (system quality number)


Discussion in Psychology and Money Management

Updated
      Top Posters
    1. looks_one Big Mike with 9 posts (2 thanks)
    2. looks_two Luger with 5 posts (9 thanks)
    3. looks_3 Sandpaddict with 4 posts (2 thanks)
    4. looks_4 Wikmar with 3 posts (4 thanks)
      Best Posters
    1. looks_one caprica with 2 thanks per post
    2. looks_two Luger with 1.8 thanks per post
    3. looks_3 Wikmar with 1.3 thanks per post
    4. looks_4 Big Mike with 0.2 thanks per post
    1. trending_up 32,000 views
    2. thumb_up 26 thanks given
    3. group 31 followers
    1. forum 42 posts
    2. attach_file 5 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Van Tharp's SQN (system quality number)

(login for full post details)
  #1 (permalink)
 caprica 
USA
 
Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 113 received

Hello. I just uploaded this to the Ninja Strategies section. It is really a unique method to optimize your strategies on.

This is Van Tharp's System Quality Number (SQN) optimizer type for NinjaTrader. Place the SQN.cs file in your Documents\NinjaTrader 6.5\bin\custom\Type directory and then exit and reload Ninja.

Here is information from Ragingbull on SQN:

Quoting 
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.

This is exactly what all good traders should be looking for their system.

The code itself was written by Pete S all credit to him.

If you want more information on the SQN (System Quality Number) or Van Tharp you can look here:
Definitive Guide to Position Sizing

To use this you need to use Strategy Analyzer and change your "Optimize on..." selection to "my system quality number". This is where you normally choose max net profit, or max profit factor, etc.

Download the file here:

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Started this thread Reply With Quote
The following 3 users say Thank You to caprica for this post:

Can you help answer these questions
from other members on futures io?
Questioning Conventional Wisdom
Treasury Notes and Bonds
1 min chart v-shape scan help please
ThinkOrSwim
TradingView help in improving Anchored Vwap
Platforms and Indicators
TD Sequential for NT or MW?
Platforms and Indicators
MacdBB V402 NT804 + gradient + pullback not working on N …
NinjaTrader
 
 
(login for full post details)
  #2 (permalink)
 caprica 
USA
 
Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 113 received

Here is a brief PDF that is a sample only of the table of contents from the publisher of Van Tharp's book "Definitive Guide to Position Sizing", to whet your appetitive and interest you in purchasing this book.

Attached Thumbnails
Van Tharp's SQN (system quality number)-table-contents-definitive-guide.pdf  
Started this thread Reply With Quote
The following user says Thank You to caprica for this post:
 
(login for full post details)
  #3 (permalink)
kekkis
Norway
 
 
Posts: 6 since Jun 2009
Thanks: 1 given, 1 received


Hi

Do you have SQN update for ninja 7
thanks
regards

Reply With Quote
 
(login for full post details)
  #4 (permalink)
 fluxsmith 
Santa Maria
 
Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker: Mirus/Zen-Fire
Trading: ES
 
Posts: 295 since May 2010
Thanks: 97 given, 322 received


kekkis View Post
...Do you have SQN update for ninja 7...

I'd suggest you see:

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to fluxsmith for this post:
 
(login for full post details)
  #5 (permalink)
 pengi 
Tokyo, Japan
 
Experience: Intermediate
Platform: NT7
Trading: GC
 
pengi's Avatar
 
Posts: 35 since Jan 2011
Thanks: 26 given, 40 received


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

Hi @caprica,

Thanks for your contribution towards helping everyone optimize their systems for SQN. I'm a big fan of Tharp's work as well.

However, I believe the formula you posted above is incorrect, or at least flawed in a big way.

From what I understand, Tharp basis is the risk of each trade, which he calls R. He uses the R-multiple of trades to calculate the SQN. However, the formula you posted doesn't use R at all. Since you are going by what someone else posted, I want to ask you to double check this. Please consider the following method of how I calculate the SQN for my trades. It's my interpretation of Tharp's words, but I may be wrong as well. What do you think?

1) Calculate R, how much you risk per trade. For example, if you risk 2% of your account on each trade, and you have a $10k account, R would be 200.

2) Calculate the R-multiple of each trade. For example, if R is 200 and a given trade had a net profit of 400, then the trade's R-multiple was 2. If it lost 200, then the R-multiple for that trade is -1.

3) Calculate E, the expectancy of the system. I interpret this to be the average R-multiple of all trades. If your system has a positive expectancy, this should be greater than zero.

4) Calculate SQN, the ratio of E to the standard deviation of the R multiples dataset in step 2.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
mehol
United Arab Emirates
 
 
Posts: 2 since Oct 2011
Thanks: 0 given, 0 received

I want to understand how to build up a system as VAN TAHRP talks about low risk idea.

Reply With Quote
 
(login for full post details)
  #7 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,131 since Jun 2009
Thanks: 32,602 given, 98,792 received

@Luger,

Regarding the SQN*maxprofit you shared. Years ago I used a similar scoring system, but it also weighted based on trade frequency as well as long vs short. I am having trouble finding my old Optimizer Type code, so thought I would ask if you would code this, since I am so rusty with NT.

The idea is to expand on your SQN*maxprofit, adding:

1) Higher score for more trades per day. I value this because I believe if a system has a true edge, then greater frequency can demonstrate that edge by beating out slippage and commissions, and fight curve fitting.

2) Weight score based on Long vs Short performance. For example, if Long's account for 80% of profit, then this would score badly. Optimal would be 50/50.

Thank you kindly, if you could do this for me.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following 2 users say Thank You to Big Mike for this post:
 
(login for full post details)
  #8 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
 
Posts: 882 since Mar 2011
Thanks: 124 given, 701 received


Big Mike View Post
@Luger,

Regarding the SQN*maxprofit you shared. Years ago I used a similar scoring system, but it also weighted based on trade frequency as well as long vs short. I am having trouble finding my old Optimizer Type code, so thought I would ask if you would code this, since I am so rusty with NT.

The idea is to expand on your SQN*maxprofit, adding:

1) Higher score for more trades per day. I value this because I believe if a system has a true edge, then greater frequency can demonstrate that edge by beating out slippage and commissions, and fight curve fitting.

2) Weight score based on Long vs Short performance. For example, if Long's account for 80% of profit, then this would score badly. Optimal would be 50/50.

Thank you kindly, if you could do this for me.

Mike

Mike, I agree with your effort to sanity check the system and ensure that it's not long or short biased, but how do you account for the dataset bias?

If you were to take an data set for CL from the highs of 2008 till today, featuring a trend trading system, obviously you're going to generate more profit on the short side, simply because the entire market moved short a great deal (macro) from then till now.

I guess I would prefer to use the long/short ratios as a sanity check or post analysis screening criteria rather than an evaluation criteria (depending on the system's approach).

I do the same thing for profit distributions. Rarely (if ever) is a system able to hit high marks on every criteria (drawdown, expectancy, trade sample size, etc) and I find that some systems, I largely rejected simply because it earned too high of a profit% in a couple of months during the sample. Obviously, we'd all love a consistent profit distribution where every month is similar. But in reality, the markets don't feed us that way, and it's difficult to massage a system to vary depending on the market conditions (sometimes).

So now I look at the distributions and as long as all the profit isn't in one or 2 months AND there's little to no negative months, then that's okay. I call it the "fishing" centric systems, that wait (patiently) for those few time periods that really kill it, then during the other time periods they either hold flat or lose a very small amount.

Obviously that's asking a lot (for a trader to sit and fish for months waiting on the whopper months) but it's exactly what a lot of Fundamental traders do. There are a lot of fundamental traders that will make their whole year based on a couple of good months. Which really capitalizes on the concept of big winners and tiny losers.

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
The following 2 users say Thank You to RM99 for this post:
 
(login for full post details)
  #9 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,131 since Jun 2009
Thanks: 32,602 given, 98,792 received


RM99 View Post
Mike, I agree with your effort to sanity check the system and ensure that it's not long or short biased, but how do you account for the dataset bias?

Yes absolutely. I basically write two kinds of strategies, small time frame and big time frame. For the small time frame system I believe the 50/50 split is realistic because the amount of time in the market is minimal per trade, it is not influenced heavily by bigger trends.

I wish I could find my old code, I spent a huge amount of time developing that optimizer type just the way I wanted it. It is in a backup file somewhere.

I cannot remember all the reserve keywords with NT, so am having trouble remembering how I had mine set up.

If there are 100 trades total, 50 long, 50 short, but the 50 longs account for 80% of the profit, I want this to score badly. My strategy is not written well if it takes 50 short trades that only account for 20% of the profit compared to long trades.

I had a lot of code in my optimizer setup to prevent curve fitting. I also prefer to optimize against huge data sets, multi-year of tick data, with thousands of trades per year. I'll keep digging for it.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #10 (permalink)
 Luger 
Nashville, TN
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB
Trading: NQ ES
 
Posts: 468 since Feb 2011
Thanks: 323 given, 543 received



Big Mike View Post
@Luger,

Regarding the SQN*maxprofit you shared. Years ago I used a similar scoring system, but it also weighted based on trade frequency as well as long vs short. I am having trouble finding my old Optimizer Type code, so thought I would ask if you would code this, since I am so rusty with NT.

The idea is to expand on your SQN*maxprofit, adding:

1) Higher score for more trades per day. I value this because I believe if a system has a true edge, then greater frequency can demonstrate that edge by beating out slippage and commissions, and fight curve fitting.

2) Weight score based on Long vs Short performance. For example, if Long's account for 80% of profit, then this would score badly. Optimal would be 50/50.

Thank you kindly, if you could do this for me.

Mike

I will take a detailed look this evening. #2 should not be hard, with #1 I will have to figure out how to get a proper day count.

Reply With Quote
The following user says Thank You to Luger for this post:


futures io Trading Community Psychology and Money Management > Van Tharp's SQN (system quality number)


Last Updated on May 12, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing

Your Charts Should Speak To You w/Bob Cometta

Elite only
 

Our 12-year anniversary w/ $$,$$$ prizes (check soon)

August
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts