Historic Volatility on tick stream

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Historic Volatility on tick stream

Postby gmiller » Thu Jul 12, 2012 6:35 pm

In finance, volatility is a measure for variation of price of a financial instrument over time. Historic volatility is derived from time series of past market prices. It is common for discussions to talk about the volatility of a security's price, even while it is the returns' volatility that is being measured. It is used to quantify the risk of the financial instrument over the specified time period. Volatility is normally expressed in annualized terms and in %.


http://fxcodebase.com/wiki/index.php/HistoricVolatility_on_tick_stream
Attachments
HV_TICK.png
gmiller
 
Posts: 11
Joined: Thu Feb 09, 2012 3:22 pm

Re: Historic Volatility on tick stream

Postby gmiller » Mon Jul 16, 2012 1:54 pm

The lua files attached for your convenience
HV.lua
Historic Volatility complete
(8.98 KiB) Downloaded 1028 times

HV_TICK.lua
Historic Volatility on a tick stream
(6.28 KiB) Downloaded 1019 times

HV on Chart.lua
(10.33 KiB) Downloaded 786 times

HV_TICK on Chart.lua
(7.93 KiB) Downloaded 773 times


The indicator was revised and updated
gmiller
 
Posts: 11
Joined: Thu Feb 09, 2012 3:22 pm

Re: Historic Volatility on tick stream

Postby Jeffreyvnlk » Thu Jul 11, 2013 7:24 pm

Why people interested in tick ? If 2000 or 2 contracts traded, there is still 1 tick. More tick but not more volume or fewer tick but more volume. So you would be free if forget all about tick.IMHO
Jeffreyvnlk
FXCodeBase: Graduate
 
Posts: 302
Joined: Wed Apr 11, 2012 2:17 pm


Re: Historic Volatility on tick stream

Postby Apprentice » Wed Jul 02, 2014 2:06 am

Unfortunately I can not reproduce this crash.
Advice, try to do a complete uninstall and install.
If this continues after this please contact me again.

As for indicator formula, This is a simplified version.
Code: Select all
   
       LogReturn[period] = Log (close[period] / open[period]);

    sigma = 100 * (Stdev of LogReturn for Last Period Periods);
   
        if    Annualization then    
       sigma= sigma *  Sqrt( Number of days since the beginning of the year.);
      end

     HV[period] =  sigma;
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36476
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Historic Volatility on tick stream

Postby xyz1453 » Thu Jul 17, 2014 7:19 pm

Hi

Is there any mql4 version of this indicator?Thanks.
xyz1453
 
Posts: 6
Joined: Thu Jul 17, 2014 6:39 pm


Re: Historic Volatility on tick stream

Postby zmender » Sat Jul 19, 2014 8:44 pm

I tried to call this indicator from a strategy but received "364: [string "C:\Gehtsoft\IndicoreSDK\indicators\HV.lua"]:178: attempt to index field 'close' (a nil value)" error. What do you think the problem is? It occurs during the update line

Declaration:
Code: Select all
    Source = ExtSubscribe(2, nil, instance.parameters.TF, instance.parameters.Type == "Bid", "bar");
   LP = core.indicators:create("HV", Source[Price1], LongPeriod);

Code: Select all
    LP:update(core.UpdateLast);
zmender
 
Posts: 43
Joined: Thu Nov 10, 2011 11:00 pm

Re: Historic Volatility on tick stream

Postby Apprentice » Sun Jul 20, 2014 3:44 am

HV is using the whole bar.
In your example HV is only getting close component of Bar.

You should use this
LP = core.indicators: create ("HV", Source, longperiod);
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36476
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia



Return to Custom Indicators

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 74 guests

cron