Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

System Quality Number for Indexes and ETFs Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
gjbkdunn
Posted : Wednesday, February 2, 2011 7:55:53 PM
Registered User
Joined: 3/10/2005
Posts: 13

In Van Tharp's review of the overall market he uses his "System Quality Number" SQN to measure market performance for various issues. 
I'd like to create the SQN plot for stocks but I am not a programmer.
The SQN basically consists of the following formula:
N= the lookback period

SquareRoot N * [Average (daily % change over N periods) / (Std Dev  daily % change over N periods)   ]

The daily % change would be the close to the previous close.
Can someone create an indicator that I can drop on a price chart and change the lookback period.
Thanks
Greg

Bruce_L
Posted : Thursday, February 3, 2011 5:22:15 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I'm guessing at the order of operations to some extent, but since taking the square root of the entire thing would result in an error if the Average of the Percent Changes are negative, I'm assuming the order is correct.

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:System Quality Number
'|******************************************************************
'# Period = UserInput.Integer = 10
Static Sum(1) As Single
Static Factor As Single
If isFirstBar Then
    Sum(0) = 0
    Sum(1) = 0
    Factor = Period ^ .5
Else If CurrentIndex > Period Then
    Sum(0) += Price.PercentChange - Price.PercentChange(1, Period)
    Sum(1) += Price.PercentChange ^ 2 - Price.PercentChange(1, Period) ^ 2
Else
    Sum(0) += Price.PercentChange
    Sum(1) += Price.PercentChange ^ 2
End If
If CurrentIndex >= Period Then
    Plot = Factor * Sum(0) / Period / (((Sum(1) - Sum(0) ^ 2 / Period) / Period) ^ .5)
Else
    Plot = Single.NaN
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
nxasokan
Posted : Wednesday, January 7, 2015 3:59:19 PM
Registered User
Joined: 7/18/2011
Posts: 16

Is there a similar solution for TC 2000 users? I would like to calculate SQN using a lookback period of 100 days. SQN=

SQN = SquareRoot(100) * (Average of daily % change for 100 days / StdDev of daily % change for 100 days). Thanks.

Bruce_L
Posted : Wednesday, January 7, 2015 5:07:47 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Maybe something like the following?

10 * ((C / C1 + C1 / C2 + C2 / C3 + C3 / C4 + C4 / C5 + C5 / C6 + C6 / C7 + C7 / C8 + C8 / C9 + C9 / C10 + C10 / C11 + C11 / C12 + C12 / C13 + C13 / C14 + C14 / C15 + C15 / C16 + C16 / C17 + C17 / C18 + C18 / C19 + C19 / C20 + C20 / C21 + C21 / C22 + C22 / C23 + C23 / C24 + C24 / C25 + C25 / C26 + C26 / C27 + C27 / C28 + C28 / C29 + C29 / C30 + C30 / C31 + C31 / C32 + C32 / C33 + C33 / C34 + C34 / C35 + C35 / C36 + C36 / C37 + C37 / C38 + C38 / C39 + C39 / C40 + C40 / C41 + C41 / C42 + C42 / C43 + C43 / C44 + C44 / C45 + C45 / C46 + C46 / C47 + C47 / C48 + C48 / C49 + C49 / C50 + C50 / C51 + C51 / C52 + C52 / C53 + C53 / C54 + C54 / C55 + C55 / C56 + C56 / C57 + C57 / C58 + C58 / C59 + C59 / C60 + C60 / C61 + C61 / C62 + C62 / C63 + C63 / C64 + C64 / C65 + C65 / C66 + C66 / C67 + C67 / C68 + C68 / C69 + C69 / C70 + C70 / C71 + C71 / C72 + C72 / C73 + C73 / C74 + C74 / C75 + C75 / C76 + C76 / C77 + C77 / C78 + C78 / C79 + C79 / C80 + C80 / C81 + C81 / C82 + C82 / C83 + C83 / C84 + C84 / C85 + C85 / C86 + C86 / C87 + C87 / C88 + C88 / C89 + C89 / C90 + C90 / C91 + C91 / C92 + C92 / C93 + C93 / C94 + C94 / C95 + C95 / C96 + C96 / C97 + C97 / C98 + C98 / C99 + C99 / C100) / 100 - 1) / SQR(ABS((C / C1) ^ 2 + (C1 / C2) ^ 2 + (C2 / C3) ^ 2 + (C3 / C4) ^ 2 + (C4 / C5) ^ 2 + (C5 / C6) ^ 2 + (C6 / C7) ^ 2 + (C7 / C8) ^ 2 + (C8 / C9) ^ 2 + (C9 / C10) ^ 2 + (C10 / C11) ^ 2 + (C11 / C12) ^ 2 + (C12 / C13) ^ 2 + (C13 / C14) ^ 2 + (C14 / C15) ^ 2 + (C15 / C16) ^ 2 + (C16 / C17) ^ 2 + (C17 / C18) ^ 2 + (C18 / C19) ^ 2 + (C19 / C20) ^ 2 + (C20 / C21) ^ 2 + (C21 / C22) ^ 2 + (C22 / C23) ^ 2 + (C23 / C24) ^ 2 + (C24 / C25) ^ 2 + (C25 / C26) ^ 2 + (C26 / C27) ^ 2 + (C27 / C28) ^ 2 + (C28 / C29) ^ 2 + (C29 / C30) ^ 2 + (C30 / C31) ^ 2 + (C31 / C32) ^ 2 + (C32 / C33) ^ 2 + (C33 / C34) ^ 2 + (C34 / C35) ^ 2 + (C35 / C36) ^ 2 + (C36 / C37) ^ 2 + (C37 / C38) ^ 2 + (C38 / C39) ^ 2 + (C39 / C40) ^ 2 + (C40 / C41) ^ 2 + (C41 / C42) ^ 2 + (C42 / C43) ^ 2 + (C43 / C44) ^ 2 + (C44 / C45) ^ 2 + (C45 / C46) ^ 2 + (C46 / C47) ^ 2 + (C47 / C48) ^ 2 + (C48 / C49) ^ 2 + (C49 / C50) ^ 2 + (C50 / C51) ^ 2 + (C51 / C52) ^ 2 + (C52 / C53) ^ 2 + (C53 / C54) ^ 2 + (C54 / C55) ^ 2 + (C55 / C56) ^ 2 + (C56 / C57) ^ 2 + (C57 / C58) ^ 2 + (C58 / C59) ^ 2 + (C59 / C60) ^ 2 + (C60 / C61) ^ 2 + (C61 / C62) ^ 2 + (C62 / C63) ^ 2 + (C63 / C64) ^ 2 + (C64 / C65) ^ 2 + (C65 / C66) ^ 2 + (C66 / C67) ^ 2 + (C67 / C68) ^ 2 + (C68 / C69) ^ 2 + (C69 / C70) ^ 2 + (C70 / C71) ^ 2 + (C71 / C72) ^ 2 + (C72 / C73) ^ 2 + (C73 / C74) ^ 2 + (C74 / C75) ^ 2 + (C75 / C76) ^ 2 + (C76 / C77) ^ 2 + (C77 / C78) ^ 2 + (C78 / C79) ^ 2 + (C79 / C80) ^ 2 + (C80 / C81) ^ 2 + (C81 / C82) ^ 2 + (C82 / C83) ^ 2 + (C83 / C84) ^ 2 + (C84 / C85) ^ 2 + (C85 / C86) ^ 2 + (C86 / C87) ^ 2 + (C87 / C88) ^ 2 + (C88 / C89) ^ 2 + (C89 / C90) ^ 2 + (C90 / C91) ^ 2 + (C91 / C92) ^ 2 + (C92 / C93) ^ 2 + (C93 / C94) ^ 2 + (C94 / C95) ^ 2 + (C95 / C96) ^ 2 + (C96 / C97) ^ 2 + (C97 / C98) ^ 2 + (C98 / C99) ^ 2 + (C99 / C100) ^ 2 - (C / C1 + C1 / C2 + C2 / C3 + C3 / C4 + C4 / C5 + C5 / C6 + C6 / C7 + C7 / C8 + C8 / C9 + C9 / C10 + C10 / C11 + C11 / C12 + C12 / C13 + C13 / C14 + C14 / C15 + C15 / C16 + C16 / C17 + C17 / C18 + C18 / C19 + C19 / C20 + C20 / C21 + C21 / C22 + C22 / C23 + C23 / C24 + C24 / C25 + C25 / C26 + C26 / C27 + C27 / C28 + C28 / C29 + C29 / C30 + C30 / C31 + C31 / C32 + C32 / C33 + C33 / C34 + C34 / C35 + C35 / C36 + C36 / C37 + C37 / C38 + C38 / C39 + C39 / C40 + C40 / C41 + C41 / C42 + C42 / C43 + C43 / C44 + C44 / C45 + C45 / C46 + C46 / C47 + C47 / C48 + C48 / C49 + C49 / C50 + C50 / C51 + C51 / C52 + C52 / C53 + C53 / C54 + C54 / C55 + C55 / C56 + C56 / C57 + C57 / C58 + C58 / C59 + C59 / C60 + C60 / C61 + C61 / C62 + C62 / C63 + C63 / C64 + C64 / C65 + C65 / C66 + C66 / C67 + C67 / C68 + C68 / C69 + C69 / C70 + C70 / C71 + C71 / C72 + C72 / C73 + C73 / C74 + C74 / C75 + C75 / C76 + C76 / C77 + C77 / C78 + C78 / C79 + C79 / C80 + C80 / C81 + C81 / C82 + C82 / C83 + C83 / C84 + C84 / C85 + C85 / C86 + C86 / C87 + C87 / C88 + C88 / C89 + C89 / C90 + C90 / C91 + C91 / C92 + C92 / C93 + C93 / C94 + C94 / C95 + C95 / C96 + C96 / C97 + C97 / C98 + C98 / C99 + C99 / C100) ^ 2 / 100) / 100)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
nxasokan
Posted : Wednesday, January 7, 2015 10:17:11 PM
Registered User
Joined: 7/18/2011
Posts: 16

Thank you very much. It works.

diceman
Posted : Thursday, January 8, 2015 11:55:42 AM
Registered User
Joined: 1/28/2005
Posts: 6,049

QUOTE (Bruce_L)

Maybe something like the following?

10 * ((C / C1 + C1 / C2 + C2 / C3 + C3 / C4 + C4 / C5 + C5 / C6 + C6 / C7 + C7 / C8 + C8 / C9 + C9 / C10 + C10 / C11 + C11 / C12 + C12 / C13 + C13 / C14 + C14 / C15 + C15 / C16 + C16 / C17 + C17 / C18 + C18 / C19 + C19 / C20 + C20 / C21 + C21 / C22 + C22 / C23 + C23 / C24 + C24 / C25 + C25 / C26 + C26 / C27 + C27 / C28 + C28 / C29 + C29 / C30 + C30 / C31 + C31 / C32 + C32 / C33 + C33 / C34 + C34 / C35 + C35 / C36 + C36 / C37 + C37 / C38 + C38 / C39 + C39 / C40 + C40 / C41 + C41 / C42 + C42 / C43 + C43 / C44 + C44 / C45 + C45 / C46 + C46 / C47 + C47 / C48 + C48 / C49 + C49 / C50 + C50 / C51 + C51 / C52 + C52 / C53 + C53 / C54 + C54 / C55 + C55 / C56 + C56 / C57 + C57 / C58 + C58 / C59 + C59 / C60 + C60 / C61 + C61 / C62 + C62 / C63 + C63 / C64 + C64 / C65 + C65 / C66 + C66 / C67 + C67 / C68 + C68 / C69 + C69 / C70 + C70 / C71 + C71 / C72 + C72 / C73 + C73 / C74 + C74 / C75 + C75 / C76 + C76 / C77 + C77 / C78 + C78 / C79 + C79 / C80 + C80 / C81 + C81 / C82 + C82 / C83 + C83 / C84 + C84 / C85 + C85 / C86 + C86 / C87 + C87 / C88 + C88 / C89 + C89 / C90 + C90 / C91 + C91 / C92 + C92 / C93 + C93 / C94 + C94 / C95 + C95 / C96 + C96 / C97 + C97 / C98 + C98 / C99 + C99 / C100) / 100 - 1) / SQR(ABS((C / C1) ^ 2 + (C1 / C2) ^ 2 + (C2 / C3) ^ 2 + (C3 / C4) ^ 2 + (C4 / C5) ^ 2 + (C5 / C6) ^ 2 + (C6 / C7) ^ 2 + (C7 / C8) ^ 2 + (C8 / C9) ^ 2 + (C9 / C10) ^ 2 + (C10 / C11) ^ 2 + (C11 / C12) ^ 2 + (C12 / C13) ^ 2 + (C13 / C14) ^ 2 + (C14 / C15) ^ 2 + (C15 / C16) ^ 2 + (C16 / C17) ^ 2 + (C17 / C18) ^ 2 + (C18 / C19) ^ 2 + (C19 / C20) ^ 2 + (C20 / C21) ^ 2 + (C21 / C22) ^ 2 + (C22 / C23) ^ 2 + (C23 / C24) ^ 2 + (C24 / C25) ^ 2 + (C25 / C26) ^ 2 + (C26 / C27) ^ 2 + (C27 / C28) ^ 2 + (C28 / C29) ^ 2 + (C29 / C30) ^ 2 + (C30 / C31) ^ 2 + (C31 / C32) ^ 2 + (C32 / C33) ^ 2 + (C33 / C34) ^ 2 + (C34 / C35) ^ 2 + (C35 / C36) ^ 2 + (C36 / C37) ^ 2 + (C37 / C38) ^ 2 + (C38 / C39) ^ 2 + (C39 / C40) ^ 2 + (C40 / C41) ^ 2 + (C41 / C42) ^ 2 + (C42 / C43) ^ 2 + (C43 / C44) ^ 2 + (C44 / C45) ^ 2 + (C45 / C46) ^ 2 + (C46 / C47) ^ 2 + (C47 / C48) ^ 2 + (C48 / C49) ^ 2 + (C49 / C50) ^ 2 + (C50 / C51) ^ 2 + (C51 / C52) ^ 2 + (C52 / C53) ^ 2 + (C53 / C54) ^ 2 + (C54 / C55) ^ 2 + (C55 / C56) ^ 2 + (C56 / C57) ^ 2 + (C57 / C58) ^ 2 + (C58 / C59) ^ 2 + (C59 / C60) ^ 2 + (C60 / C61) ^ 2 + (C61 / C62) ^ 2 + (C62 / C63) ^ 2 + (C63 / C64) ^ 2 + (C64 / C65) ^ 2 + (C65 / C66) ^ 2 + (C66 / C67) ^ 2 + (C67 / C68) ^ 2 + (C68 / C69) ^ 2 + (C69 / C70) ^ 2 + (C70 / C71) ^ 2 + (C71 / C72) ^ 2 + (C72 / C73) ^ 2 + (C73 / C74) ^ 2 + (C74 / C75) ^ 2 + (C75 / C76) ^ 2 + (C76 / C77) ^ 2 + (C77 / C78) ^ 2 + (C78 / C79) ^ 2 + (C79 / C80) ^ 2 + (C80 / C81) ^ 2 + (C81 / C82) ^ 2 + (C82 / C83) ^ 2 + (C83 / C84) ^ 2 + (C84 / C85) ^ 2 + (C85 / C86) ^ 2 + (C86 / C87) ^ 2 + (C87 / C88) ^ 2 + (C88 / C89) ^ 2 + (C89 / C90) ^ 2 + (C90 / C91) ^ 2 + (C91 / C92) ^ 2 + (C92 / C93) ^ 2 + (C93 / C94) ^ 2 + (C94 / C95) ^ 2 + (C95 / C96) ^ 2 + (C96 / C97) ^ 2 + (C97 / C98) ^ 2 + (C98 / C99) ^ 2 + (C99 / C100) ^ 2 - (C / C1 + C1 / C2 + C2 / C3 + C3 / C4 + C4 / C5 + C5 / C6 + C6 / C7 + C7 / C8 + C8 / C9 + C9 / C10 + C10 / C11 + C11 / C12 + C12 / C13 + C13 / C14 + C14 / C15 + C15 / C16 + C16 / C17 + C17 / C18 + C18 / C19 + C19 / C20 + C20 / C21 + C21 / C22 + C22 / C23 + C23 / C24 + C24 / C25 + C25 / C26 + C26 / C27 + C27 / C28 + C28 / C29 + C29 / C30 + C30 / C31 + C31 / C32 + C32 / C33 + C33 / C34 + C34 / C35 + C35 / C36 + C36 / C37 + C37 / C38 + C38 / C39 + C39 / C40 + C40 / C41 + C41 / C42 + C42 / C43 + C43 / C44 + C44 / C45 + C45 / C46 + C46 / C47 + C47 / C48 + C48 / C49 + C49 / C50 + C50 / C51 + C51 / C52 + C52 / C53 + C53 / C54 + C54 / C55 + C55 / C56 + C56 / C57 + C57 / C58 + C58 / C59 + C59 / C60 + C60 / C61 + C61 / C62 + C62 / C63 + C63 / C64 + C64 / C65 + C65 / C66 + C66 / C67 + C67 / C68 + C68 / C69 + C69 / C70 + C70 / C71 + C71 / C72 + C72 / C73 + C73 / C74 + C74 / C75 + C75 / C76 + C76 / C77 + C77 / C78 + C78 / C79 + C79 / C80 + C80 / C81 + C81 / C82 + C82 / C83 + C83 / C84 + C84 / C85 + C85 / C86 + C86 / C87 + C87 / C88 + C88 / C89 + C89 / C90 + C90 / C91 + C91 / C92 + C92 / C93 + C93 / C94 + C94 / C95 + C95 / C96 + C96 / C97 + C97 / C98 + C98 / C99 + C99 / C100) ^ 2 / 100) / 100)

 

Can you provide a 30 period version.

 

Thanks

 

Bruce_L
Posted : Thursday, January 8, 2015 12:02:11 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Please try the following Indicator Formula.

SQR(30) * ((C / C1 + C1 / C2 + C2 / C3 + C3 / C4 + C4 / C5 + C5 / C6 + C6 / C7 + C7 / C8 + C8 / C9 + C9 / C10 + C10 / C11 + C11 / C12 + C12 / C13 + C13 / C14 + C14 / C15 + C15 / C16 + C16 / C17 + C17 / C18 + C18 / C19 + C19 / C20 + C20 / C21 + C21 / C22 + C22 / C23 + C23 / C24 + C24 / C25 + C25 / C26 + C26 / C27 + C27 / C28 + C28 / C29 + C29 / C30) / 30 - 1) / SQR(ABS((C / C1) ^ 2 + (C1 / C2) ^ 2 + (C2 / C3) ^ 2 + (C3 / C4) ^ 2 + (C4 / C5) ^ 2 + (C5 / C6) ^ 2 + (C6 / C7) ^ 2 + (C7 / C8) ^ 2 + (C8 / C9) ^ 2 + (C9 / C10) ^ 2 + (C10 / C11) ^ 2 + (C11 / C12) ^ 2 + (C12 / C13) ^ 2 + (C13 / C14) ^ 2 + (C14 / C15) ^ 2 + (C15 / C16) ^ 2 + (C16 / C17) ^ 2 + (C17 / C18) ^ 2 + (C18 / C19) ^ 2 + (C19 / C20) ^ 2 + (C20 / C21) ^ 2 + (C21 / C22) ^ 2 + (C22 / C23) ^ 2 + (C23 / C24) ^ 2 + (C24 / C25) ^ 2 + (C25 / C26) ^ 2 + (C26 / C27) ^ 2 + (C27 / C28) ^ 2 + (C28 / C29) ^ 2 + (C29 / C30) ^ 2 - (C / C1 + C1 / C2 + C2 / C3 + C3 / C4 + C4 / C5 + C5 / C6 + C6 / C7 + C7 / C8 + C8 / C9 + C9 / C10 + C10 / C11 + C11 / C12 + C12 / C13 + C13 / C14 + C14 / C15 + C15 / C16 + C16 / C17 + C17 / C18 + C18 / C19 + C19 / C20 + C20 / C21 + C21 / C22 + C22 / C23 + C23 / C24 + C24 / C25 + C25 / C26 + C26 / C27 + C27 / C28 + C28 / C29 + C29 / C30) ^ 2 / 30) / 30)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
diceman
Posted : Tuesday, March 10, 2015 2:10:24 PM
Registered User
Joined: 1/28/2005
Posts: 6,049

This is actually defined as:

 

Expectancy = (probability of win * average win) - (probability of loss * average loss)

You have a system that wins 30% of the time. When it wins it nets you 5R while losing trades lose 1R:

(0.3 * 5) - (0.7 * 1) = 1.5 - 0.7 = 0.8

 

SQN - system quality number - which was developed by Van Tharp and is used to evaluate the overall quality of a trading system.

The formula is as follows:

SQN = root(n) * expectancy / stdev(R)

root(n) - the square root of the number of all trades
expectancy - as shown above and measured in R multiples
stdev(R) - the standard deviation of your profit/loss R multiples

 

Usually a SQN score of between 1.6 - 1.9 is considered poor but tradable. 2.0 - 2.5 is average. 2.5 - 2.9 is good and anything above 3.0 is deemed excellent.

 

Thanks

 

Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.