NexusFi: Find Your Edge


Home Menu

 





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 Shivaya with 2 thanks per post
    3. looks_3 Luger with 1.8 thanks per post
    4. looks_4 Wikmar with 1.3 thanks per post
    1. trending_up 44,773 views
    2. thumb_up 26 thanks given
    3. group 30 followers
    1. forum 42 posts
    2. attach_file 5 attachments




 
Search this Thread

Van Tharp's SQN (system quality number)

  #1 (permalink)
 
caprica's Avatar
 caprica 
USA
 
Experience: Master
Platform: NinjaTrader
Posts: 155 since Jul 2009
Thanks Given: 45
Thanks Received: 114

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
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
27 thanks
Tao te Trade: way of the WLD
23 thanks
Diary of a simple price action trader
22 thanks
My NQ Trading Journal
14 thanks
GFIs1 1 DAX trade per day journal
9 thanks
  #2 (permalink)
 
caprica's Avatar
 caprica 
USA
 
Experience: Master
Platform: NinjaTrader
Posts: 155 since Jul 2009
Thanks Given: 45
Thanks Received: 114

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
Thanked by:
  #3 (permalink)
kekkis
Norway
 
Posts: 6 since Jun 2009
Thanks Given: 1
Thanks Received: 1


Hi

Do you have SQN update for ninja 7
thanks
regards

Reply With Quote
  #4 (permalink)
 fluxsmith 
Santa Maria
 
Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 290 since May 2010
Thanks Given: 97
Thanks Received: 322


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

I'd suggest you see:

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 
pengi's Avatar
 pengi 
Tokyo, Japan
 
Experience: Intermediate
Platform: NT7
Trading: GC
Posts: 35 since Jan 2011
Thanks Given: 26
Thanks Received: 40


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
  #6 (permalink)
mehol
United Arab Emirates
 
Posts: 2 since Oct 2011
Thanks Given: 0
Thanks Received: 0

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

Reply With Quote
  #7 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,440 since Jun 2009
Thanks Given: 33,207
Thanks Received: 101,599

@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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


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
Thanked by:
  #9 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,440 since Jun 2009
Thanks Given: 33,207
Thanks Received: 101,599


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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #10 (permalink)
 Luger 
Nashville, TN
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB
Trading: NQ ES
Posts: 468 since Feb 2011
Thanks Given: 323
Thanks Received: 543



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
Thanked by:




Last Updated on May 12, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts