Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/7/2004 Posts: 131
|
I am using the formula below in stock finder for 100 day historical volatility. This was written by Bruce in a reply to another question from someone else.
The PCF below is a PCF I am using in TC 2000. The results and the order of stocks ranked by volatility is not the same when the same watch lists were used in the two different programs.
I am doing the comparison on Saturday afternoon with all the data in both progams up to date. Could you please tell me which one is correct and how I would write a correct formula for the one that is incorrect. Thanks
'# Period = UserInput.integer = 100
Static sumofsqr As Single
If CurrentIndex >= Period + 1 Then
sumofsqr += System.Math.Log(Price.Last / Price.Last(1)) ^ 2 - _
System.Math.Log(Price.Last(Period) / Price.Last(Period + 1)) ^ 2
Else If isFirstBar Then
sumofsqr = 0
Else
sumofsqr += System.Math.Log(Price.Last / Price.Last(1)) ^ 2
End If
If CurrentIndex >= Period Then
Plot = 1600 * ((sumofsqr - _
(System.Math.Log(Price.Last / Price.Last(Period)) ^ 2) / Period) / Period) ^ .5
Else
Plot = Single.NaN
End If
PCF for historical Volitality for TC2000
((MAXH100 - MINL100) / ((MAXH100 + MINL100) / 2))
|
|
Registered User Joined: 12/12/2004 Posts: 5
|
You might take a look here: http://forums.worden.com/default.aspx?g=posts&t=1866
I've just gotten into Stockfinder, but it appears that the formula you have for it is logarithmic, while the TC formula you are using is merely an average of the range for 100 days. So I would try the one I have noted above to see if the results are closer.
|
|
Registered User Joined: 10/7/2004 Posts: 131
|
Thanks for the info. The formula below matches exactly the 100 day HV in stock finder.
This leads me to one further question. I was trying to create 3 HV ratios. Two of them were on the link you gave me, they have the 6/100 day HV ratios and the 10/100 day HV ratios. I was also trying to create a 6 day /25 day historic volatilty ratio. I have included the dialogue that was in the link you gave me so as to explain what I was looking for.
100 day HV ratio
1600*SQR((LOG(C/C1)^2 +LOG(C1/C2)^2 +LOG(C2/C3)^2 +LOG(C3/C4)^2 +LOG(C4/C5)^2 +LOG(C5/C6)^2 +LOG(C6/C7)^2 +LOG(C7/C8)^2 +LOG(C8/C9)^2 +LOG(C9/C10)^2 +LOG(C10/C11)^2 +LOG(C11/C12)^2 +LOG(C12/C13)^2 +LOG(C13/C14)^2 +LOG(C14/C15)^2 +LOG(C15/C16)^2 +LOG(C16/C17)^2 +LOG(C17/C18)^2 +LOG(C18/C19)^2 +LOG(C19/C20)^2 +LOG(C20/C21)^2 +LOG(C21/C22)^2 +LOG(C22/C23)^2 +LOG(C23/C24)^2 +LOG(C24/C25)^2 +LOG(C25/C26)^2 +LOG(C26/C27)^2 +LOG(C27/C28)^2 +LOG(C28/C29)^2 +LOG(C29/C30)^2 +LOG(C30/C31)^2 +LOG(C31/C32)^2 +LOG(C32/C33)^2 +LOG(C33/C34)^2 +LOG(C34/C35)^2 +LOG(C35/C36)^2 +LOG(C36/C37)^2 +LOG(C37/C38)^2 +LOG(C38/C39)^2 +LOG(C39/C40)^2 +LOG(C40/C41)^2 +LOG(C41/C42)^2 +LOG(C42/C43)^2 +LOG(C43/C44)^2 +LOG(C44/C45)^2 +LOG(C45/C46)^2 +LOG(C46/C47)^2 +LOG(C47/C48)^2 +LOG(C48/C49)^2 +LOG(C49/C50)^2 +LOG(C50/C51)^2 +LOG(C51/C52)^2 +LOG(C52/C53)^2 +LOG(C53/C54)^2 +LOG(C54/C55)^2 +LOG(C55/C56)^2 +LOG(C56/C57)^2 +LOG(C57/C58)^2 +LOG(C58/C59)^2 +LOG(C59/C60)^2 +LOG(C60/C61)^2 +LOG(C61/C62)^2 +LOG(C62/C63)^2 +LOG(C63/C64)^2 +LOG(C64/C65)^2 +LOG(C65/C66)^2 +LOG(C66/C67)^2 +LOG(C67/C68)^2 +LOG(C68/C69)^2 +LOG(C69/C70)^2 +LOG(C70/C71)^2 +LOG(C71/C72)^2 +LOG(C72/C73)^2 +LOG(C73/C74)^2 +LOG(C74/C75)^2 +LOG(C75/C76)^2 +LOG(C76/C77)^2 +LOG(C77/C78)^2 +LOG(C78/C79)^2 +LOG(C79/C80)^2 +LOG(C80/C81)^2 +LOG(C81/C82)^2 +LOG(C82/C83)^2 +LOG(C83/C84)^2 +LOG(C84/C85)^2 +LOG(C85/C86)^2 +LOG(C86/C87)^2 +LOG(C87/C88)^2 +LOG(C88/C89)^2 +LOG(C89/C90)^2 +LOG(C90/C91)^2 +LOG(C91/C92)^2 +LOG(C92/C93)^2 +LOG(C93/C94)^2 +LOG(C94/C95)^2 +LOG(C95/C96)^2 +LOG(C96/C97)^2 +LOG(C97/C98)^2 +LOG(C98/C99)^2 +LOG(C99/C100)^2-(LOG(C/C100)^2)/100)/100)
DIALOGUE
Could you please translate the following information to TC2000, and plot the data as an indicator (6/100HV).
a. Compute for the 6-day historical volatility:
1. Take the natural logarithm of Today's close divided by Yesterday's close;
2. Take the standard deviation of the result of(1) for 6 trading days;
3. Multiply the result of (2) by 100, then multiply all by the square root of 256.
b. Compute for the 100-day historical volatility.
c. Divide the 6-dayHV by 100-dayHV
If plotting an indicator is not possible, may be an PCF scan for the 6/100HV ratio can be done?
Thank you.
Back to top HYPERLINK "/default.aspx?g=profile&u=9"Craig_S
Posted :
Friday, January 21, 2005 7:57:19 AM |
|
Worden Trainer
Joined: 10/1/2004
Posts: 18,819
This looks possible (but very involved). Give us some time and check back soon.
- Craig
Here to Help! Back to top HYPERLINK "/default.aspx?g=profile&u=25026"roniseb
Posted :
Monday, January 24, 2005 4:58:49 PM |
|
Registered User
Joined: 1/13/2005
Posts: 9
Yep, please post them so I can give it a try on my system. Please indicate if it can be done as a scan or an indicator.
Thank you very much guys.
Ron Back to top HYPERLINK "/default.aspx?g=profile&u=4158"Bruce_L
Posted :
Monday, January 24, 2005 7:04:33 PM |
|
Worden Trainer
Joined: 10/7/2004
Posts: 24,957
This is what I came up with:
6/100 HV Ratio:
SQR((LOG(C/C1)^2 +LOG(C1/C2)^2 +LOG(C2/C3)^2 +LOG(C3/C4)^2 +LOG(C4/C5)^2 +LOG(C5/C6)^2-(LOG(C/C6)^2)/6)/6)/SQR((LOG(C/C1)^2 +LOG(C1/C2)^2 +LOG(C2/C3)^2 +LOG(C3/C4)^2 +LOG(C4/C5)^2 +LOG(C5/C6)^2 +LOG(C6/C7)^2 +LOG(C7/C8)^2 +LOG(C8/C9)^2 +LOG(C9/C10)^2 +LOG(C10/C11)^2 +LOG(C11/C12)^2 +LOG(C12/C13)^2 +LOG(C13/C14)^2 +LOG(C14/C15)^2 +LOG(C15/C16)^2 +LOG(C16/C17)^2 +LOG(C17/C18)^2 +LOG(C18/C19)^2 +LOG(C19/C20)^2 +LOG(C20/C21)^2 +LOG(C21/C22)^2 +LOG(C22/C23)^2 +LOG(C23/C24)^2 +LOG(C24/C25)^2 +LOG(C25/C26)^2 +LOG(C26/C27)^2 +LOG(C27/C28)^2 +LOG(C28/C29)^2 +LOG(C29/C30)^2 +LOG(C30/C31)^2 +LOG(C31/C32)^2 +LOG(C32/C33)^2 +LOG(C33/C34)^2 +LOG(C34/C35)^2 +LOG(C35/C36)^2 +LOG(C36/C37)^2 +LOG(C37/C38)^2 +LOG(C38/C39)^2 +LOG(C39/C40)^2 +LOG(C40/C41)^2 +LOG(C41/C42)^2 +LOG(C42/C43)^2 +LOG(C43/C44)^2 +LOG(C44/C45)^2 +LOG(C45/C46)^2 +LOG(C46/C47)^2 +LOG(C47/C48)^2 +LOG(C48/C49)^2 +LOG(C49/C50)^2 +LOG(C50/C51)^2 +LOG(C51/C52)^2 +LOG(C52/C53)^2 +LOG(C53/C54)^2 +LOG(C54/C55)^2 +LOG(C55/C56)^2 +LOG(C56/C57)^2 +LOG(C57/C58)^2 +LOG(C58/C59)^2 +LOG(C59/C60)^2 +LOG(C60/C61)^2 +LOG(C61/C62)^2 +LOG(C62/C63)^2 +LOG(C63/C64)^2 +LOG(C64/C65)^2 +LOG(C65/C66)^2 +LOG(C66/C67)^2 +LOG(C67/C68)^2 +LOG(C68/C69)^2 +LOG(C69/C70)^2 +LOG(C70/C71)^2 +LOG(C71/C72)^2 +LOG(C72/C73)^2 +LOG(C73/C74)^2 +LOG(C74/C75)^2 +LOG(C75/C76)^2 +LOG(C76/C77)^2 +LOG(C77/C78)^2 +LOG(C78/C79)^2 +LOG(C79/C80)^2 +LOG(C80/C81)^2 +LOG(C81/C82)^2 +LOG(C82/C83)^2 +LOG(C83/C84)^2 +LOG(C84/C85)^2 +LOG(C85/C86)^2 +LOG(C86/C87)^2 +LOG(C87/C88)^2 +LOG(C88/C89)^2 +LOG(C89/C90)^2 +LOG(C90/C91)^2 +LOG(C91/C92)^2 +LOG(C92/C93)^2 +LOG(C93/C94)^2 +LOG(C94/C95)^2 +LOG(C95/C96)^2 +LOG(C96/C97)^2 +LOG(C97/C98)^2 +LOG(C98/C99)^2 +LOG(C99/C100)^2-(LOG(C/C100)^2)/100)/100)
Please keep in mind my warnings that it can really slow things down.
-Bruce
I WAS TRYING TO CREATE A 6/25 DAY HISTORIC VOLATILITY RATIO SIMILAR TO THE ONE ABOVE. THANKS CELO
|
|
Registered User Joined: 12/12/2004 Posts: 5
|
Glad it worked.
Math isn't at the top of my skills anymore, but I would adapt the 6/100 by stopping at the 25 point and adjusting the final divisors to 25/25 rather than 100/100.
Are you using these for option trading? Or looking at cross-overs of the shorter term? Or something else?
|
|
Registered User Joined: 10/7/2004 Posts: 131
|
Have not tried the formula, but I am looking at the ratios to try and predict when big moves are coming in stocks and ETFs. Although the ratios have been historically used in trading options they are also good for stocks and ETFS.
If a ten day reading is under half of the 100 day or the 6 day is 35% less than the 100 day or the 6 day is 25% less than the 25 day or any combinations of these which make for a clearer reading there is likely to be a big more in the stocks or ETFS.
|
|
Registered User Joined: 10/7/2004 Posts: 131
|
I created the following PCF for 6/25 day HV ratios using your suggestion, but I don't think it is correct as I am getting ratios of more than 1 for some stocks and ETFS.
SQR((LOG(C / C1) ^ 2 + LOG(C1 / C2) ^ 2 + LOG(C2 / C3) ^ 2 + LOG(C3 / C4) ^ 2 + LOG(C4 / C5) ^ 2 + LOG(C5 / C6) ^ 2 - (LOG(C / C6) ^ 2) / 6) / 6) / SQR((LOG(C / C1) ^ 2 + LOG(C1 / C2) ^ 2 + LOG(C2 / C3) ^ 2 + LOG(C3 / C4) ^ 2 + LOG(C4 / C5) ^ 2 + LOG(C5 / C6) ^ 2 + LOG(C6 / C7) ^ 2 + LOG(C7 / C8) ^ 2 + LOG(C8 / C9) ^ 2 + LOG(C9 / C10) ^ 2 + LOG(C10 / C11) ^ 2 + LOG(C11 / C12) ^ 2 + LOG(C12 / C13) ^ 2 + LOG(C13 / C14) ^ 2 + LOG(C14 / C15) ^ 2 + LOG(C15 / C16) ^ 2 + LOG(C16 / C17) ^ 2 + LOG(C17 / C18) ^ 2 + LOG(C18 / C19) ^ 2 + LOG(C19 / C20) ^ 2 + LOG(C20 / C21) ^ 2 + LOG(C21 / C22) ^ 2 + LOG(C22 / C23) ^ 2 + LOG(C23 / C24) ^ 2 + LOG(C24 / C25) ^ 2 - (LOG(C / C25) ^ 2) / 25) / 25)
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
celo,
Your formula would appear to be correct to me. Is there a particular reason you think the 6/25 HV Ratio should not exceed 1 (the 6/100 HV Ratio appears to do so as well)?
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 131
|
I was checking the results on a group of ETFs I trade and the highest value was .98. When I put in a stock list the values went up to 3.54 so I guess the values can go above 1. Thanks again, I was not sure the values could go above 1
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/12/2004 Posts: 5
|
If I understand the ratio, I would think even for ETF's it could exceed 1. If a stock or ETF becomes more volatile, then the shorter period would exceed the longer.
Interesting concept you have. I guess it is somewhat like Bollinger Bands? It predicts a move but not the direction?
|
|
Guest-1 |