Big Mike's Trading Forum
 

Go Back   Big Mike's Trading Forum

> Trading Forums > Psychology and Money Management


Van Tharp's SQN (system quality number)
Started:July 25th, 2009 (09:17 PM) by caprica Views / Replies:10,464 / 24
Last Reply:February 9th, 2013 (10:42 PM) Attachments:5

Welcome to Big Mike's Trading Forum.

Welcome, Guest!

This forum was established to help traders by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

BMT is fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.


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, and we will never resell your private information.

-- Big Mike
     

Reply
 5  
 
Thread Tools Search this Thread

Van Tharp's SQN (system quality number)

Old July 25th, 2012, 08:29 PM   #11 (permalink)
Fiddler
Nashville, TN
 
Trading Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IB
Favorite Instrument: NQ ES
 
Posts: 468 since Feb 2011
Thanks: 322 given, 533 received

@Big Mike

I am attaching your requested optimizer type. The new score considers Max Profit, SQN, Trades per Day, and the ratio of Long Profit to Short Profit.

There is one variable in there for the Long/Short Profit that is easy to change. I was not sure how sensitive you wanted this metric to be. I left comments in explaining.

//This value represents the floor to a divisor representing long short profit split
//0.1 = (60/40 split = 50/50 split = 40/60 split) performance would be halved at (70/30, 30/70)
//For a value of 0.05 (55/45 split = 50/50 split = 45/55 split)
//performance would be halved at (60/40, 40/60)
double rngLongShortBalance = 0.1;
//Actual calculation so that you can see what I am dividing by in the final output.
double rngLSbalance = Math.Max(rngLongShortBalance, Math.Abs(0.5 - (totLongProfit / totProfit)));

Basically, I thought you could use that variable to to set your own acceptable range outside of which there are reductions in the final score.

Otherwise the final score looks like this:

(SQN * Max Profit * Trades per Day) / (Long Short Ratio derivative)

To install place attached file in:
NinjaTrader7\bin\Custom\Type
Open Ninja Trader editor and compile any indicator or strategy

I am also going to take a look at the idea you mentioned about variation around a smooth upward sloping profit line as a possible improvement to the SQN number. Right now I can't visualize if that is going to be an improvement or end up causing problems somewhere.

Attached Files
Register to download File Type: cs SQNlsprofitbalancetraderate.cs (3.8 KB, 60 views)
Reply With Quote
     
The following 3 users say Thank You to Luger for this post:
     

Old July 25th, 2012, 08:32 PM   #12 (permalink)
Administrator: 'da Big Dawg
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Instrument: SP500, Stocks
 
Big Mike's Avatar
 
Posts: 38,260 since Jun 2009
Thanks: 25,041 given, 57,397 received


Luger View Post
@Big Mike

I am attaching your requested optimizer type. The new score considers Max Profit, SQN, Trades per Day, and the ratio of Long Profit to Short Profit.

There is one variable in there for the Long/Short Profit that is easy to change. I was not sure how sensitive you wanted this metric to be. I left comments in explaining.

//This value represents the floor to a divisor representing long short profit split
//0.1 = (60/40 split = 50/50 split = 40/60 split) performance would be halved at (70/30, 30/70)
//For a value of 0.05 (55/45 split = 50/50 split = 45/55 split)
//performance would be halved at (60/40, 40/60)
double rngLongShortBalance = 0.1;
//Actual calculation so that you can see what I am dividing by in the final output.
double rngLSbalance = Math.Max(rngLongShortBalance, Math.Abs(0.5 - (totLongProfit / totProfit)));

Basically, I thought you could use that variable to to set your own acceptable range outside of which there are reductions in the final score.

Otherwise the final score looks like this:

(SQN * Max Profit * Trades per Day) / (Long Short Ratio derivative)

To install place attached file in:
NinjaTrader7\bin\Custom\Type
Open Ninja Trader editor and compile any indicator or strategy

I am also going to take a look at the idea you mentioned about variation around a smooth upward sloping profit line as a possible improvement to the SQN number. Right now I can't visualize if that is going to be an improvement or end up causing problems somewhere.

You rock!

Mike


Want my help or input?
1) Please don't PM me, instead make a post on the forum.
2) In your post, mention me by typing @Big Mike.

If you want to support our community, become an Elite Member.

Reply With Quote
     

Old July 25th, 2012, 09:49 PM   #13 (permalink)
Fiddler
Nashville, TN
 
Trading Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IB
Favorite Instrument: NQ ES
 
Posts: 468 since Feb 2011
Thanks: 322 given, 533 received


I am attaching the Perfect Equity Curve (PEC) variants as well.

PEC
PEC * Max Profit
(PEC * Max Profit * Trades per Day) / (Long Short ratio derivative)

I would stay with the SQN and variants. The PEC versions truly do favor smoother curves at the expense of many other considerations. This ended up mostly an academic exercise, and I am posting just for anyone that is curious. Though I guess it could be used to check a smaller optimization field once the larger population has been narrowed down.

For example, I optimized one variable on my bot with just PEC. Usually the top few choices run from 58k-63k profit. Pure PEC gave me 22k for the first three, then got to some in the mid to upper 50k.

Attached Files
Register to download File Type: cs PEC.cs (2.2 KB, 46 views)
Register to download File Type: cs PECmaxprofit.cs (2.4 KB, 35 views)
Register to download File Type: cs PEClsprofitbalancetraderate.cs (3.9 KB, 33 views)
Reply With Quote
     
The following 4 users say Thank You to Luger for this post:
     

Old July 25th, 2012, 09:57 PM   #14 (permalink)
Administrator: 'da Big Dawg
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Instrument: SP500, Stocks
 
Big Mike's Avatar
 
Posts: 38,260 since Jun 2009
Thanks: 25,041 given, 57,397 received


Luger View Post
I am attaching the Perfect Equity Curve (PEC) variants as well.

PEC
PEC * Max Profit
(PEC * Max Profit * Trades per Day) / (Long Short ratio derivative)

I would stay with the SQN and variants. The PEC versions truly do favor smoother curves at the expense of many other considerations. This ended up mostly an academic exercise, and I am posting just for anyone that is curious. Though I guess it could be used to check a smaller optimization field once the larger population has been narrowed down.

For example, I optimized one variable on my bot with just PEC. Usually the top few choices run from 58k-63k profit. Pure PEC gave me 22k for the first three, then got to some in the mid to upper 50k.

Thanks for this. What kind of sample size and trade frequency did you use in your test? I can imagine the fewer the trades, the more this will not make any sense.

Mike


Want my help or input?
1) Please don't PM me, instead make a post on the forum.
2) In your post, mention me by typing @Big Mike.

If you want to support our community, become an Elite Member.

Reply With Quote
     

Old July 25th, 2012, 10:14 PM   #15 (permalink)
Fiddler
Nashville, TN
 
Trading Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IB
Favorite Instrument: NQ ES
 
Posts: 468 since Feb 2011
Thanks: 322 given, 533 received

It was small numbers compared to what I know you are planning...lol

Range was from 60 to 170 trades for those weird results. The PEC results in general, even for the variants, are certainly much more rigid than SQN. Instead of comparing to trade results to average profit and compiling, you are comparing current cumulative profit to where current cumulative profit should be based on average profit (average profit * trade number) and compiling. Effectively the variance can accrue trade to trade.

Reply With Quote
     

Old July 27th, 2012, 01:02 AM   #16 (permalink)
Administrator: 'da Big Dawg
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Instrument: SP500, Stocks
 
Big Mike's Avatar
 
Posts: 38,260 since Jun 2009
Thanks: 25,041 given, 57,397 received


Luger View Post
I am attaching the Perfect Equity Curve (PEC) variants as well.

PEC
PEC * Max Profit
(PEC * Max Profit * Trades per Day) / (Long Short ratio derivative)

I would stay with the SQN and variants. The PEC versions truly do favor smoother curves at the expense of many other considerations. This ended up mostly an academic exercise, and I am posting just for anyone that is curious. Though I guess it could be used to check a smaller optimization field once the larger population has been narrowed down.

For example, I optimized one variable on my bot with just PEC. Usually the top few choices run from 58k-63k profit. Pure PEC gave me 22k for the first three, then got to some in the mid to upper 50k.

So far the PEC model seems to be performing very well. I am still wet behind the ears when it comes to Ninja and C#, I am having to re-learn stuff all over again after being out of it for years. But it seems that your code works. Once I get some more complex strategies converted, I'll know for sure

In my testing, the PEC model produces quicker [genetic time] and more desirable results than the other SQN types you provided.

Looking forward to it, and really want to thank you again.

Mike


Want my help or input?
1) Please don't PM me, instead make a post on the forum.
2) In your post, mention me by typing @Big Mike.

If you want to support our community, become an Elite Member.

Reply With Quote
     

Old July 27th, 2012, 08:57 AM   #17 (permalink)
Elite Member
Newcastle, Australia
 
Trading Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker/Data: IB
Favorite Instrument: SPI,FTSE100, 6E, 6A
 
Posts: 284 since Oct 2010
Thanks: 106 given, 172 received

Hi
Im very interested in this topic but Im a multicharts user.
Would you have this code in a pseudo form so that I can generate easylanguage code?

Regards,
Neil.

Reply With Quote
     

Old July 27th, 2012, 05:46 PM   #18 (permalink)
Administrator: 'da Big Dawg
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Instrument: SP500, Stocks
 
Big Mike's Avatar
 
Posts: 38,260 since Jun 2009
Thanks: 25,041 given, 57,397 received


NW27 View Post
Hi
Im very interested in this topic but Im a multicharts user.
Would you have this code in a pseudo form so that I can generate easylanguage code?

Regards,
Neil.

The source was posted already, MultiCharts uses C# for its optimizer type thing (whatever it is called). They don't document anything, so good luck finding the right keywords. It is not EasyLanguage.

Mike


Want my help or input?
1) Please don't PM me, instead make a post on the forum.
2) In your post, mention me by typing @Big Mike.

If you want to support our community, become an Elite Member.

Reply With Quote
     

Old July 27th, 2012, 09:45 PM   #19 (permalink)
Elite Member
Cincinnati Ohio
 
Trading Experience: Intermediate
Platform: NinjaTrader
Broker/Data: MB Trading
Favorite Instrument: AUD
 
Silver Dragon's Avatar
 
Posts: 1,512 since Feb 2011
Thanks: 3,229 given, 3,046 received


Luger View Post
I am attaching the Perfect Equity Curve (PEC) variants as well.

PEC
PEC * Max Profit
(PEC * Max Profit * Trades per Day) / (Long Short ratio derivative)

I would stay with the SQN and variants. The PEC versions truly do favor smoother curves at the expense of many other considerations. This ended up mostly an academic exercise, and I am posting just for anyone that is curious. Though I guess it could be used to check a smaller optimization field once the larger population has been narrowed down.

For example, I optimized one variable on my bot with just PEC. Usually the top few choices run from 58k-63k profit. Pure PEC gave me 22k for the first three, then got to some in the mid to upper 50k.

@Luger

Trying to understand the code; What does this part of the code do?

SD

 
Code
for (n = 0; n < Strategy.Parameters.Count; n++)
		{
		if ("SQNMinTrades".CompareTo(Strategy.Parameters[n].Name) == 0)
			{
				minTrades = (int)Strategy.Parameters[n].Value;
				break;
			}

nosce te ipsum

Trade what the market is doing; NOT what you think its going to do.

Reply With Quote
     

Old July 27th, 2012, 10:23 PM   #20 (permalink)
Fiddler
Nashville, TN
 
Trading Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IB
Favorite Instrument: NQ ES
 
Posts: 468 since Feb 2011
Thanks: 322 given, 533 received



Silver Dragon View Post
@Luger

Trying to understand the code; What does this part of the code do?

SD

 
Code
for (n = 0; n < Strategy.Parameters.Count; n++)
		{
		if ("SQNMinTrades".CompareTo(Strategy.Parameters[n].Name) == 0)
			{
				minTrades = (int)Strategy.Parameters[n].Value;
				break;
			}

It was in the original SQN code so I left it. If there are less than 30 trades, then SQN returns zero due to too small of a sample. I think that part also checks the number of parameters in the strategy and if there are more than 30, then that number becomes the floor.

I could be totally wrong. It would be nice to have someone who is a better coder to evaluate that section because it may just be wasting cpu cycles.

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

Reply



Tags
00, account, advice, ai, big mike, book, calls, change, cl, code, color, combination, credit, custom, cycles, day, demo, don, downloads, drawdown, edge, exit, expectancy, file, fishing, fitness, formula, free, functions, greater than, guide, how to, indicator, indicators, information, interest, lot, low, macro, max profit, maximize, maxprofit, method, ml, multicharts, multiple, ninja, ninja 7, ninjatrader, nt, number, optimization, optimizer, percent, performance, plan, position sizing, position_sizing, profit, profitable, programming, reload, risk, sample, screening, setup, size, slippage, small, split, sqn, square_of_nine, standard deviation, strategies, strategy, system, system quality number, systems, testing, thank you, tharp, tick data, time, trade, trader, traders, trades, trading, trend, trend trading, trends, type, update, van tharp
     

Big Mike's Trading Forum > Trading Forums > Psychology and Money Management > Van Tharp's SQN (system quality number)

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
Van Tharp's Max Expectancy caprica Psychology and Money Management 31 January 22nd, 2015 11:55 AM
Van Tharp Books Dusty909 Psychology and Money Management 11 February 21st, 2014 01:11 PM
Position Sizing by Van Tharp Laserdan Psychology and Money Management 21 July 8th, 2011 10:37 AM
System Quality Number for MC? WayneA EasyLanguage Programming 5 July 21st, 2010 08:09 AM
What Type Trader Are You? - more from Van Tharp Trader.Jon Psychology and Money Management 0 November 12th, 2009 08:47 AM


All times are GMT -4. The time now is 05:01 PM.

Powered by vBulletin®
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2015 by Big Mike Trading. 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

Page generated 2015-04-21 in 0.14 seconds with 21 queries on phoenix via your IP 54.87.76.100