File Name: SD-ADX.efs, NormalizedStdev.efs, StochOf_NormStdev.efs, VolatilityModifiedFVE2.efs
Description:
These indicators are based on the January 2005 article, Detecting Breakouts in Low-Priced Stocks: Los Vegas Or Los Nasdaq?, by Markos Katsanos.
Formula Parameters:
SD-ADX.efs
Period for SD: 30
Period for ADX: 25
Color: Magenta
Thickness: 2
NormalizedStdev.efs
Length: 30
Color: Aqua
Thickness: 2
StochOf_NormStdev.efs
Normalized Stdev Period: 30
Stoch \%K Length: 150
Stoch \%K Smoothing: 1
Stoch \%D Length: 10
Upper Band: 80
Lower Band: 20
Band's Color: Black
Display Bands: True - [True, False]
%K Color: Red
%K Thickness: 2
%D Color: Blue
%D Thickness: 1
%D Display: Off - [On, Off]
VolatilityModifiedFVE2.efs
Periods for FVE: 14
EMA Periods for FVE: 40
Coef for Cutoff: 0.1
FVE Color: Green
FVE Thickness: 2
FVE EMA Color: Blue
FVE EMA Thickness: 1
EMA Display: Off - [On, Off]
Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
SD-ADX.efs
NormalizedStdev.efs
StochOf_NormStdev.efs
VolatilityModifiedFVE2.efs
EFS Code:
* The code for VolatilityModifiedFVE2.efs was not included here due to length restrictions for forum posts. To view the code, please open the formula in the EFS Editor.
Description:
These indicators are based on the January 2005 article, Detecting Breakouts in Low-Priced Stocks: Los Vegas Or Los Nasdaq?, by Markos Katsanos.
Formula Parameters:
SD-ADX.efs
Period for SD: 30
Period for ADX: 25
Color: Magenta
Thickness: 2
NormalizedStdev.efs
Length: 30
Color: Aqua
Thickness: 2
StochOf_NormStdev.efs
Normalized Stdev Period: 30
Stoch \%K Length: 150
Stoch \%K Smoothing: 1
Stoch \%D Length: 10
Upper Band: 80
Lower Band: 20
Band's Color: Black
Display Bands: True - [True, False]
%K Color: Red
%K Thickness: 2
%D Color: Blue
%D Thickness: 1
%D Display: Off - [On, Off]
VolatilityModifiedFVE2.efs
Periods for FVE: 14
EMA Periods for FVE: 40
Coef for Cutoff: 0.1
FVE Color: Green
FVE Thickness: 2
FVE EMA Color: Blue
FVE EMA Thickness: 1
EMA Display: Off - [On, Off]
Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
SD-ADX.efs
NormalizedStdev.efs
StochOf_NormStdev.efs
VolatilityModifiedFVE2.efs
EFS Code:
PHP Code:
/**************
Provided By : eSignal (c) Copyright 2004
Description: SD*Adx - by Markos Katsanos from Detecting Breakouts
Version 1.0
Notes:
Formula Parameters: Defaults:
Period for SD 30
Period for ADX 25
Color magenta
Thickness 2
*************/
function preMain() {
setStudyTitle("SD*Adx ");
setCursorLabelName("SD*Adx");
setDefaultBarThickness(2);
addBand(1.3, PS_SOLID, 1, Color.navy, "band");
setShowTitleParameters(false);
// Formula Parameters
var fp1 = new FunctionParameter("nPeriod", FunctionParameter.NUMBER);
fp1.setName("Period for SD");
fp1.setLowerLimit(5);
fp1.setUpperLimit(80);
fp1.setDefault(30);
var fp2 = new FunctionParameter("nDI", FunctionParameter.NUMBER);
fp2.setName("Period for ADX");
fp2.setLowerLimit(5);
fp2.setUpperLimit(80);
fp2.setDefault(25);
// Study Parameters
var sp1 = new FunctionParameter("cColor", FunctionParameter.COLOR);
sp1.setName("Color");
sp1.setDefault(Color.magenta);
var sp2 = new FunctionParameter("nThick", FunctionParameter.NUMBER);
sp2.setName("Thickness");
sp2.setDefault(2);
}
var bEdit = true;
var aPrice = null;
var vStudyMA = null;
var vStudyADX = null;
var nC = null;
function main(nPeriod, nDI, cColor, nThick) {
if (bEdit == true) {
aPrice = new Array(nPeriod);
vStudyMA = new MAStudy(nPeriod, 0, "Close", MAStudy.SIMPLE);
vStudyADX = new ADXDMStudy(nDI, nDI);
setDefaultBarFgColor(cColor, 0);
setDefaultBarThickness(nThick, 0);
bEdit = false;
}
var nState = getBarState();
if (nState == BARSTATE_NEWBAR && nC != null) {
aPrice.pop();
aPrice.unshift(nC);
}
nC = close(0);
aPrice[0] = nC;
var vMA = vStudyMA.getValue(MAStudy.MA);
if (vMA == null) return;
var vADX = vStudyADX.getValue(ADXDMStudy.ADX);
if (vADX == null) return;
if (aPrice[nPeriod-1] == null) return; // array not complete
var nSD = Stdev(nPeriod);
var nSDC = (nSD/vMA);
return (nSDC*vADX);
}
// Support Functions
function Stdev(nLength) {
var sumX = 0;
var sumX2 = 0;
for (i = 0; i < nLength; ++i) {
sumX += aPrice[i];
sumX2 += (aPrice[i] * aPrice[i]);
}
var meanX = (sumX/nLength);
var stdev = Math.sqrt((sumX2/nLength) - (meanX*meanX));
return stdev;
}
/**************
Provided By : eSignal (c) Copyright 2004
Description: Normalized Standard Deviation - Markos Katsanos
Version 1.0
Notes:
Formula Parameters: Defaults:
Length 30
Color aqua
Thickness 2
*************/
function preMain() {
setStudyTitle("Normalized Standard Deviation ");
setCursorLabelName("N-Stdev",0);
// Formula Parameters
var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
fp1.setName("Period");
fp1.setLowerLimit(1);
fp1.setDefault(30);
// Study Parameters
var sp1 = new FunctionParameter("cColor", FunctionParameter.COLOR);
sp1.setName("Color");
sp1.setDefault(Color.aqua);
var sp2 = new FunctionParameter("nThick", FunctionParameter.NUMBER);
sp2.setName("Thickness");
sp2.setDefault(2);
}
var bEdit = true;
var aValue = null;
var vStudy = null;
function main(Length, cColor, nThick) {
if (bEdit == true) {
setDefaultBarFgColor(cColor, 0);
setDefaultBarThickness(nThick, 0);
bEdit = false;
}
if (aValue == null) aValue = new Array(Length);
if (vStudy == null) vStudy = new MAStudy(Length, 0, "Close", MAStudy.SIMPLE);
var nMA = vStudy.getValue(MAStudy.MA);
if (nMA == null) return;
var nState = getBarState();
var nSum = 0;
var ySum = 0;
var Basis = 0;
var vStdDev = 0;
if (nState == BARSTATE_NEWBAR) {
aValue.pop();
aValue.unshift(close(0));
}
aValue[0] = close(0);
if (aValue[Length-1] == null) return;
for(i = 0; i < Length; i++){
nSum += (aValue[i]);
}
Basis=nSum/Length;
for(i = 0; i < Length; i++){
ySum += (aValue[i]-Basis)*(aValue[i]-Basis);
}
vStdDev=Math.sqrt(ySum/(Length));
return (vStdDev/nMA);
}
/**************
Provided By : eSignal. (c) Copyright 2004
Description: Stochastic of Normalized Standard Deviation - Markos Katsanos
Version 1.0
Notes:
Formula Parameters: Defaults:
Normalized Stdev Period 30
Stoch \%K Length 150
Stoch \%K Smoothing 1
Stoch \%D Length 10
Upper Band 80
Lower Band 20
Band's Color black
Display Bands True - [True, False]
%K Color red
%K Thickness 2
%D Color blue
%D Thickness 1
%D Display Off - [On, Off]
*************/
function preMain() {
setStudyTitle("Stochastic of Normalized Stdev");
setCursorLabelName("Stoch of SD \%K", 0);
setCursorLabelName("Stoch of SD \%D", 1);
setDefaultBarFgColor(Color.navy, 0);
setDefaultBarFgColor(Color.aqua, 1);
setStudyMax(120);
setStudyMin(-5);
// Primary Study Parameters
var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
fp1.setName("Normalized Stdev Period");
fp1.setLowerLimit(1);
fp1.setDefault(30);
// Stoch Parameters
var fp2 = new FunctionParameter("nKlength2", FunctionParameter.NUMBER);
fp2.setName("Stoch \%K Length");
fp2.setLowerLimit(1);
fp2.setDefault(150);
var fp3 = new FunctionParameter("nKsmooth2", FunctionParameter.NUMBER);
fp3.setName("Stoch \%K Smoothing");
fp3.setLowerLimit(1);
fp3.setDefault(1);
var fp4 = new FunctionParameter("nDlength2", FunctionParameter.NUMBER);
fp4.setName("Stoch \%D Length");
fp4.setLowerLimit(1);
fp4.setDefault(10);
// Study Parameters
var sp1 = new FunctionParameter("nBand1", FunctionParameter.NUMBER);
sp1.setName("Upper Band");
sp1.setDefault(80);
var sp2 = new FunctionParameter("nBand2", FunctionParameter.NUMBER);
sp2.setName("Lower Band");
sp2.setDefault(20);
var sp3 = new FunctionParameter("cBands", FunctionParameter.COLOR);
sp3.setName("Band's Color");
sp3.setDefault(Color.black);
var sp4 = new FunctionParameter("bBands", FunctionParameter.STRING);
sp4.setName("Display Bands");
sp4.addOption("On");
sp4.addOption("Off");
sp4.setDefault("On");
var sp5 = new FunctionParameter("cK", FunctionParameter.COLOR);
sp5.setName("\%K Color");
sp5.setDefault(Color.red);
var sp6 = new FunctionParameter("nThickK", FunctionParameter.NUMBER);
sp6.setName("\%K Thickness");
sp6.setDefault(2);
var sp7 = new FunctionParameter("cD", FunctionParameter.COLOR);
sp7.setName("\%D Color");
sp7.setDefault(Color.blue);
var sp8 = new FunctionParameter("nThickD", FunctionParameter.NUMBER);
sp8.setName("\%D Thickness");
sp8.setDefault(1);
var sp9 = new FunctionParameter("bD", FunctionParameter.STRING);
sp9.setName("\%D Display");
sp9.addOption("On");
sp9.addOption("Off");
sp9.setDefault("Off");
}
// Primary Study: Normalized Stdev
var aNormStdev = null;
var aValue = null;
var vStudy = null;
// Stoch of Primary Study
var bEdit = true;
var study = null;
var vK2 = null;
var vD2 = null;
var aStochK2 = null;
function main(Length, nKlength2, nKsmooth2, nDlength2, nBand1, nBand2,
cBands, bBands, cK, nThickK, cD, nThickD, bD) {
var nState = getBarState();
if (bEdit == true) {
if (bBands == "On") {
addBand(nBand1, PS_SOLID, 1, cBands, "Upper");
addBand(nBand2, PS_SOLID, 1, cBands, "Lower");
} else if (bBands == "Off") {
removeBand("Upper");
removeBand("Lower");
}
setDefaultBarFgColor(cK, 0);
setDefaultBarFgColor(cD, 1);
setDefaultBarThickness(nThickK, 0);
setDefaultBarThickness(nThickD, 1);
if (aStochK2 == null) aStochK2 = new Array(Math.round(nDlength2));
bEdit = false;
}
if (nState == BARSTATE_NEWBAR) {
if (vK2 != null) {
aStochK2.pop();
aStochK2.unshift(vK2);
}
}
//primary study code: Stoch of Normalized Stdev
if (aNormStdev == null) aNormStdev = new Array(nKlength2);
if (aValue == null) aValue = new Array(Length);
if (vStudy == null) vStudy = new MAStudy(Length, 0, "Close", MAStudy.SIMPLE);
var nMA = vStudy.getValue(MAStudy.MA);
if (nMA == null) return;
var nSum = 0;
var ySum = 0;
var Basis = 0;
var vStdDev = 0;
if (nState == BARSTATE_NEWBAR) {
aValue.pop();
aValue.unshift(close(0));
aNormStdev.pop();
aNormStdev.unshift(0);
}
aValue[0] = close(0);
if (aValue[Length-1] == null) return;
for(i = 0; i < Length; i++){
nSum += (aValue[i]);
}
Basis=nSum/Length;
for(i = 0; i < Length; i++){
ySum += (aValue[i]-Basis)*(aValue[i]-Basis);
}
vStdDev = (Math.sqrt(ySum/(Length)))/nMA;
aNormStdev[0] = vStdDev;
// end of primary study code
// Stoch of Normalized Stdev
vK2 = StochK2(Math.round(nKlength2), Math.round(nKsmooth2));
if (vK2 == null) return;
aStochK2[0] = vK2;
if (aStochK2[Math.round(nDlength2) - 1] == null) return;
vD2 = StochD2(Math.round(nDlength2));
if (vD2 == null) return;
if (bD == "On") {
return new Array(vK2, vD2);
} else {
return new Array(vK2, vD2.toFixed(4));
}
}
/*********************/
/***** Functions *****/
/*********************/
function StochHH(nInputOffset, nInputLength) {
var nOffset = nInputOffset;
var nLength = nInputLength;
var hh = 0;
var i = 0;
for(i = 0; i < nLength; i++) {
if(i == 0) {
hh = aNormStdev[i+nOffset];
} else {
hh = Math.max(hh, aNormStdev[i+nOffset]);
}
}
return hh;
}
function StochLL(nInputOffset, nInputLength) {
var nOffset = nInputOffset;
var nLength = nInputLength;
var ll = 0;
var i = 0;
for(i = 0; i < nLength; i++) {
if(i == 0) {
ll = aNormStdev[i+nOffset];
} else {
ll = Math.min(ll, aNormStdev[i+nOffset]);
}
}
return ll;
}
function StochK2(inputLength, inputSmoothing) {
var percentK;
var StochK;
var ll, hh;
var sum = 0;
var i = 0;
var nOffset = 0;
var nDO;
var nLength = inputLength;
var nSmoothing = inputSmoothing;
for(i = 0; i < nSmoothing; i++) {
nDO = i + nOffset;
StochK = aNormStdev[nDO];
ll = StochLL(nDO, nLength);
if(ll == null) return null;
hh = StochHH(nDO, nLength);
if(hh == null) return null;
percentK = ((StochK - ll) / (hh - ll)) * 100;
sum += percentK;
}
sum /= nSmoothing;
return sum;
}
function StochD2(nInputLength) {
var sum = 0;
var i = 0;
for (i = 0; i < nInputLength; ++i) {
sum += aStochK2[i];
}
sum /= nInputLength;
return sum;
}