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 |

Historical Volatility and HV ratio plot for StockFinder Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Leutchik
Posted : Wednesday, May 20, 2009 2:00:02 PM
Registered User
Joined: 10/7/2004
Posts: 16

I cannot find Historical Volatility as an indicator.

I need to use this, with a user-settable input. (but typically 100)

I also need to be able to do an Historical Volatility ratio plot; typically the 6/100.

I note that Bruce L dealt with these issues before for Telechart, so I expected they'd be built into StockFinder.

Thanks.
Bruce_L
Posted : Wednesday, May 20, 2009 2:27:49 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You could create a Daily Historical Volatility using the following RealCode Indicator:

'# 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

You could create a Daily Historical Volatility Ratio using the following RealCode Indicator:

'# ShortHV = UserInput.Integer = 6
'# LongHV = UserInput.Integer = 100
Static Sum(1) As Single
If isFirstBar Then
    Sum(0) = 0
    Sum(1) = 0
Else
    Sum(0) += System.Math.Log(Price.Last / Price.Last(1)) ^ 2
    Sum(1) += System.Math.Log(Price.Last / Price.Last(1)) ^ 2
End If
If CurrentIndex > ShortHV Then Sum(0) -= System.Math.Log(Price.Last(ShortHV) / _
        Price.Last(ShortHV + 1)) ^ 2
If CurrentIndex > LongHV Then Sum(1) -= System.Math.Log(Price.Last(LongHV) / _
        Price.Last(LongHV + 1)) ^ 2
If CurrentIndex >= 100 Then
    Plot = ((Sum(0) - (System.Math.Log(Price.Last / Price.Last(ShortHV)) ^ 2) / _
        ShortHV) / ShortHV) ^ .5 / _
        ((Sum(1) - (System.Math.Log(Price.Last / Price.Last(LongHV)) ^ 2) / _
        LongHV) / LongHV) ^ .5
Else
    Plot = Single.NaN
End If

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
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.