File Name: VolatilityModifiedFVE.efs
Description:
FVE (Volatility Modified)
Formula Parameters:
Samples : 22
Perma : 40
Cintra : 0.1
Cinter : 0.1
Notes:
This is another version of FVE indicator that we have posted earlier
in this forum.
This version has an important enhancement to the previous one that`s
especially useful with intraday minute charts.
Due to the volatility had not been taken into account to avoid the extra
complication in the formula, the previous formula has some drawbacks:
The main drawback is that the constant cutoff coefficient will overestimate
price changes in minute charts and underestimate corresponding changes in
weekly or monthly charts.
And now the indicator uses adaptive cutoff coefficient which will adjust to
all time frames automatically.
Download File:
VolatilityModifiedFVE.efs
EFS Code:
Description:
FVE (Volatility Modified)
Formula Parameters:
Samples : 22
Perma : 40
Cintra : 0.1
Cinter : 0.1
Notes:
This is another version of FVE indicator that we have posted earlier
in this forum.
This version has an important enhancement to the previous one that`s
especially useful with intraday minute charts.
Due to the volatility had not been taken into account to avoid the extra
complication in the formula, the previous formula has some drawbacks:
The main drawback is that the constant cutoff coefficient will overestimate
price changes in minute charts and underestimate corresponding changes in
weekly or monthly charts.
And now the indicator uses adaptive cutoff coefficient which will adjust to
all time frames automatically.
Download File:
VolatilityModifiedFVE.efs
EFS Code:
PHP Code:
/*********************************
Provided By:
eSignal (Copyright c eSignal), a division of Interactive Data
Corporation. 2009. All rights reserved. This sample eSignal
Formula Script (EFS) is for educational purposes only and may be
modified and saved under a new file name. eSignal is not responsible
for the functionality once modified. eSignal reserves the right
to modify and overwrite this EFS file with each new release.
Description:
FVE (Volatility Modified)
Version: 1.0 05/26/2009
Formula Parameters: Default:
Samples 22
Perma 40
Cintra 0.1
Cinter 0.1
Notes:
This is another version of FVE indicator that we have posted earlier
in this forum.
This version has an important enhancement to the previous one that`s
especially useful with intraday minute charts.
Due to the volatility had not been taken into account to avoid the extra
complication in the formula, the previous formula has some drawbacks:
The main drawback is that the constant cutoff coefficient will overestimate
price changes in minute charts and underestimate corresponding changes in
weekly or monthly charts.
And now the indicator uses adaptive cutoff coefficient which will adjust to
all time frames automatically.
**********************************/
var fpArray = new Array();
var bInit = false;
function preMain() {
setStudyTitle("Volatility Finite Volume Elements");
setCursorLabelName("FVI",0);
setDefaultBarFgColor(Color.green,0);
setCursorLabelName("FVI EMA",1);
setDefaultBarFgColor(Color.blue,1);
setDefaultBarThickness(2);
addBand(0, PS_SOLID, 1, Color.black);
var x = 0;
fpArray[x] = new FunctionParameter("Samples", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setLowerLimit(1);
setDefault(22);
}
var x = 0;
fpArray[x] = new FunctionParameter("Perma", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setLowerLimit(1);
setDefault(40);
}
var x = 0;
fpArray[x] = new FunctionParameter("Cintra", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setLowerLimit(0.001);
setDefault(0.1);
}
var x = 0;
fpArray[x] = new FunctionParameter("Cinter", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setLowerLimit(0.001);
setDefault(0.1);
}
}
var xModVol = null;
var xModVolEMA = null;
function main(Samples, Perma, Cintra, Cinter){
var nBarState = getBarState();
var nModVol = 0;
var nModVolEMA = 0;
if (nBarState == BARSTATE_ALLBARS) {
if(Samples == null) Samples = 22;
if(Perma == null) Perma = 40;
if(Cintra == null) Cintra = 0.1;
if(Cinter == null) Cinter = 0.1;
}
if (bInit == false) {
xModVol = efsInternal("Calc_ModVolatility", Samples, Perma, Cintra, Cinter);
xModVolEMA = getSeries(xModVol, 1);
bInit = true;
}
nModVol = xModVol.getValue(0);
nModVolEMA = xModVolEMA.getValue(0);
if (nModVolEMA == null) return;
return new Array(nModVol, nModVolEMA);
}
var bSecondInit = false;
var xVolumePlusMinus = null;
var xVolume = null;
var xFVE = null;
var xEMAFVE = null;
function Calc_ModVolatility(Samples, Perma, Cintra, Cinter) {
var nRes = 0;
if (bSecondInit == false) {
xVolume = volume();
xVolumePlusMinus = efsInternal("Calc_VolumePlusMinus", Samples, xVolume, Cintra, Cinter);
xFVE = efsInternal("Calc_FVE", Samples, xVolumePlusMinus, xVolume);
xEMAFVE = ema(Perma, xFVE);
bSecondInit = true;
}
nFVE = xFVE.getValue(0);
nEMA = xEMAFVE.getValue(0);
if (nEMA == null) return;
return new Array(nFVE, nEMA);
}
function Calc_FVE(Samples, xVolumePlusMinus, xVolume) {
var nRes = 0;
var Fvesum = 0;
var VolSum = 0;
var i = 0;
for(i = 0; i < Samples; i++) {
Fvesum += xVolumePlusMinus.getValue(-i);
VolSum += xVolume.getValue(-i);
}
nRes = (Fvesum / VolSum) * 100;
return nRes;
}
var bThridInit = false;
var xClose = null;
var xhlc3 = null;
var xhl2 = null;
var xIntra = null;
var xInter = null;
var xStDevIntra = null;
var xStDevInter = null;
function Calc_VolumePlusMinus(Samples, xVolume, Cintra, Cinter) {
var nRes = 0;
var TP = 0;
var TP1 = 0;
var Intra = 0;
var Vintra = 0;
var Inter = 0;
var Vinter = 0;
var CutOff = 0;
var MF = 0;
if (bThridInit == false) {
xClose = close();
xhlc3 = hlc3();
xhl2 = hl2();
xIntra = efsInternal("Calc_Intra", xhlc3);
xInter = getSeries(xIntra, 1);
xStDevIntra = efsInternal("Calc_StdDev", Samples, sma(Samples, xIntra), xIntra);
xStDevInter = efsInternal("Calc_StdDev", Samples, sma(Samples, xInter), xInter);
bThridInit = true;
}
TP = xhlc3.getValue(0);
TP1 = xhlc3.getValue(-1);
Intra = xIntra.getValue(0);
Vintra = xStDevIntra.getValue(0);
Inter = xInter.getValue(0);
Vinter = xStDevInter.getValue(0);
CutOff = Cintra * Vintra + Cinter * Vinter;
MF = xClose.getValue(0) - xhl2.getValue(0) + TP - TP1;
if(MF > CutOff * xClose.getValue(0))
FveFactor = 1;
else if(MF < -1 * CutOff * xClose.getValue(0))
FveFactor = -1;
else
FveFactor = 0;
nRes = xVolume.getValue(0) * FveFactor;
return nRes;
}
function Calc_Intra(xhlc3) {
var nResIntra = 0;
var nResInter = 0;
if (xhlc3.getValue(-1) == null) return;
nResIntra = Math.log(high(0)) - Math.log(low(0));
nResInter = Math.log(xhlc3.getValue(0)) - Math.log(xhlc3.getValue(-1));
return new Array(nResIntra, nResInter);
}
function Calc_StdDev(nPeriod, xMA, xSeries) {
var StdDev = 0;
var SumSqr = 0;
var counter = 0;
if(xMA.getValue(0) == null) return;
for(counter = 0; counter < nPeriod; counter++)
SumSqr += Math.pow((xSeries.getValue(-counter) - xMA.getValue(0)), 2);
StdDev = Math.sqrt(SumSqr / nPeriod);
return StdDev;
}