log in     sign up for free
 
Combine your enthusiasm, energy, focus, devotion, and discipline to becoming the best trader you can be, but once you have done that, there is no point in agonizing over the details.
Jack D. Schwager
 
 
Home
systems (284)
 
Special offer: buy AmiBroker and EOD+Real-Time Data
 
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

Historical Volatility

Formula for: TradeStation

indicator


 

 

Views:  3131

Added: June 06, 2008
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5

3

1 ratings
 

email this link

 
 
Tags: TradeStation, indicator
 
Your Ad Here
Origin: omega-list
Written by: Craig Nelson
Date found: 6 oct 97

OK, a little background. This indicator will calculate the correct Historical Volatility, that is the REAL historical volatility based on the daily changes(and not Omega definition of volatility) in closing prices. As far as I know, and based on what I see in my indicator list, there isn't a UF or Indicator that does this. For those that trade options, historical vol is what is compared to market-implied vol to help detect overpriced/underpriced situations and how to figure out if premiums are fat or lean. Anyway, the Indicator verifies OK, but when I try to format the indicator in a chart I get a GPF from TS. I'm not sure if this might be caused by a "stack overflow" from the multitudinous calculations, or if there is a "divide by zero" problem that slipped through the cracks. Can others copy and paste this code into TS and see if they get a GPF?

The above code is a combination of "reinventing the wheel", "divide and conquer", and the useful suggestions that poured in after I sent out my initial request. I'm certainly no EL expert, but I'm learning. Thanks to all who helped. Hopefully, if we can get the GPF bug worked out this should be a useful indicator to have, assuming Omega hasn't already included it in TS 4.0 or their next release. My version of TS is 3.51.

 

 



Code:

Type : Indicator, Name : Historical Volatility

{ Name: Historical Volatility Created: 10/6/97 02:05 PM }

vars:
SumSqr(0),
Mean(0),
Sum(0),
counter(0),
Hist_Vol(0);

inputs:
Length(18);

array:
Stdarray[100](0);

if Length > 0 and close > 0 then begin

Sum = 0;
for counter = 0 to (Length-1) begin
Stdarray[counter] = Log(close[counter] / close[counter+1]);
Sum = Stdarray[counter] + Sum;
end;

Mean = Sum / Length;

SumSqr = 0;
for counter = 0 to (Length-1) begin
SumSqr = SumSqr + ((Stdarray[counter] - Mean) * (Stdarray[counter] -
Mean));
end;

Hist_Vol = SquareRoot(SumSqr / Length)*SquareRoot(250);

end
else
Hist_Vol = 0;

plot1(Hist_Vol, "Hist_Vol");

 






Author: Craig Nelson
Source: http://home.iae.nl

 

View similar (indicator for TradeStation):

Gap-Trading System
Color on MACD Histogram
Double Smoothed Exponential Moving Average
Better Bollinger Bands
Simple Futures MA Indicator
Weekly Hi-Lo Lines
Pivot Bar
Gap-Trading System
Trend Continuation Factor
Stochastics
...
 
 
all formulas for TradeStation
all formulas

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
 
Privacy note | (c) copyrights systems4trading.com 2006-2012