TS SUPPORT
home contacts site map search
MultiCharts MCFX Other Products & Services Support Company

You are here:  Home > Support > Knowledgebase

Knowledgebase


Search in     for   
     
Miscellaneous > Hist Volatility [eSignal EFS Indicators]


Download: HistVolatility.efs

Category: Indicator > Miscellaneous

Description:

Markets oscillate from periods of low volatility to high volatility and back. The author`s research indicates that after periods of extremely low volatility, volatility tends to increase and price may move sharply. This increase in volatility tends to correlate with the beginning of short- to intermediate-term moves in price. They have found that we can identify which markets are about to make such a move by measuring the historical volatility and the application of pattern recognition.

The indicator is calculating as the standard deviation of day-to-day logarithmic closing price changes expressed as an annualized percentage.



Inputs:

Lookbck - lookback period
Annual - number of days in year

EFS Code:
/*******************************************************************

Provided By : Developed by TS Support, LLC for eSignal. (c) Copyright 2002
********************************************************************/

function preMain()
{
setPriceStudy(false);
setStudyTitle("Hist Volatility");
setCursorLabelName("HisVol");
}
function main(LookBack, Annual)
{
if (LookBack == null) LookBack = 20;
if (Annual == null) Annual = 365;
var Interval = getInterval();
var Per = 0;
if (Interval == "1") Per = 1;
if (Interval == "5") Per = 1;
if (Interval == "10") Per = 1;
if (Interval == "15") Per = 1;
if (Interval == "D") Per = 1;
if (Per == 0) Per = 7;
var Close = getValue("Close", 0, -(LookBack + 1));
var Price = Math.log(Close[0] / Close[1]);
if (LookBack <= 0) return;
var Avg = 0.0;
var i = 0;
for (i = 0; i < LookBack; i++)
{
Price = Math.log(Close[i] / Close[i + 1]);
Avg += Price;
}
Avg /= LookBack;
var SumSqr = 0.0;
for (i = 0; i < LookBack; i++)
{
Price = Math.log(Close[i] / Close[i + 1]);
SumSqr += (Price - Avg) * (Price - Avg);
}
var StdDev = Math.sqrt(SumSqr / LookBack);
var HVol = (StdDev * Math.sqrt(Annual / Per)) * 100;
return HVol;
}


Support Menu

Contact Customer Support


Discussion Forum


Online Tutorials


Downloads & Check Version


Knowledgebase

Toll Free

Latest Events

June 29
We are starting beta-testing of MultiCharts 6.0 Beta 4.

September 10
We are glad to announce the release of MultiCharts 5.5!

September 10
Users of MultiCharts's can now subscribe to Barchart's real-time data feeds from $49/m.

February 10
MultiCharts received GOLD in Trade2Win's 2008 Members' Choice Awards.

Devember 8
Free MCFX PRO is now also available with Forex.com




© 1999-2010 TS Support, LLC. All rights reserved.