File Name: GardnerVolatility.efs
Description:
Profit With High Relative Strength Mutual Funds, by Gerald Gardner
Formula Parameters:
Volatility HOTFX Color : Blue
Volatility FHYTX Color : Red
Volatility HOTFX Color : Green
Display Cursor Labels : True
SMA Length For HOTFX : 10
SMA Length For FHYTX : 20
Line Thickness : 2
Notes:
The related article is copyrighted material. If you are not
a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
GardnerVolatility.efs
EFS Code:
Description:
Profit With High Relative Strength Mutual Funds, by Gerald Gardner
Formula Parameters:
Volatility HOTFX Color : Blue
Volatility FHYTX Color : Red
Volatility HOTFX Color : Green
Display Cursor Labels : True
SMA Length For HOTFX : 10
SMA Length For FHYTX : 20
Line Thickness : 2
Notes:
The related article is copyrighted material. If you are not
a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
GardnerVolatility.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:
Profit With High Relative Strength Mutual Funds, by Gerald Gardner
Version: 1.0 02/06/2009
Formula Parameters: Default:
Volatility HOTFX Color Blue
Volatility FHYTX Color Red
Volatility HOTFX Color Green
Display Cursor Labels True
SMA Length For HOTFX 10
SMA Length For FHYTX 20
Line Thickness 2
Notes:
The related article is copyrighted material. If you are not
a subscriber of Stocks & Commodities, please visit [url]www.traders.com.[/url]
**********************************/
var fpArray = new Array();
var bInit = false;
var bVersion = null;
function preMain() {
setPriceStudy(false);
setShowCursorLabel(false);
setShowTitleParameters( false );
setStudyTitle("Gardner Volatility");
setCursorLabelName("Volatility HOTFX", 0);
setCursorLabelName("Volatility FHYTX", 1);
setCursorLabelName("Close - Avg", 2);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_HISTOGRAM, 0);
setDefaultBarThickness(2, 0);
setDefaultBarFgColor(Color.red, 1);
setPlotType(PLOTTYPE_HISTOGRAM, 1);
setDefaultBarThickness(2, 1);
setDefaultBarFgColor(Color.green, 2);
setPlotType(PLOTTYPE_HISTOGRAM, 2);
setDefaultBarThickness(2, 2);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("LineColor1", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("Volatility HOTFX Color");
setDefault(Color.blue);
}
fpArray[x] = new FunctionParameter("LineColor2", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("Volatility FHYTX Color");
setDefault(Color.red);
}
fpArray[x] = new FunctionParameter("LineColor3", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("Volatility HOTFX Color");
setDefault(Color.green);
}
fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Display Cursor Labels");
setDefault(true);
}
fpArray[x] = new FunctionParameter("LengthHOTFX", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("SMA Length For HOTFX");
setLowerLimit(1);
setDefault(10);
}
fpArray[x] = new FunctionParameter("LengthFHYTX", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("SMA Length For FHYTX");
setLowerLimit(1);
setDefault(20);
}
fpArray[x] = new FunctionParameter("Thickness", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("Line Thickness");
setLowerLimit(1);
setDefault(2);
}
}
var xPrice_FHYTX = null;
var xSMA20_FHYTX = null;
var xStdDev20_FHYTX = null;
var xSMA10_HOTFX = null;
var xStdDev10_HOTFX = null;
function main(LengthHOTFX, LengthFHYTX, LineColor1, LineColor2, LineColor3, Thickness, ViewValue) {
var nbdiffbuy = 0;
var ndiffsell = 0;
var nCloseGreaterSMA10 = 0;
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if ( bInit == false ) {
setDefaultBarFgColor(LineColor1, 0);
setDefaultBarThickness(Thickness, 0);
setDefaultBarFgColor(LineColor2, 1);
setDefaultBarThickness(Thickness, 1);
setDefaultBarFgColor(LineColor3, 2);
setDefaultBarThickness(Thickness, 2);
setShowCursorLabel(ViewValue);
xPrice_FHYTX = close("FHYTX, D");
xSMA20_FHYTX = sma(20, xPrice_FHYTX);
xStdDev20_FHYTX = efsInternal("StdDev", 20, xSMA20_FHYTX);
xSMA10_HOTFX = sma(10);
xStdDev10_HOTFX = efsInternal("StdDev", 10, close());
bInit = true;
}
if (xStdDev20_FHYTX.getValue(0) == null || xStdDev10_HOTFX.getValue(0) == null) return;
ndiffbuy = (xPrice_FHYTX.getValue(0) - xSMA20_FHYTX.getValue(0)) / (2 * xStdDev20_FHYTX.getValue(0));
ndiffsell = (close(0) - xSMA10_HOTFX.getValue(0)) / (2 * xStdDev10_HOTFX.getValue(0));
nCloseGreaterSMA10 = close(0) - xSMA10_HOTFX.getValue(0);
if (Strategy.isLong()) {
if (ndiffbuy < -1 && ndiffsell < -1) {
Strategy.doSell("Exit Long", Strategy.CLOSE, Strategy.THISBAR);
drawTextRelative(-1, 0, "Exit Long", Color.black, Color.red, Text.VCENTER | Text.BOLD | Text.PRESET, null, null, "Txt" + getValue("time"));
}
} else {
if (ndiffbuy > 1) {
if (nCloseGreaterSMA10 > 0) {
Strategy.doLong("Enter Long", Strategy.MARKET, Strategy.NEXTBAR);
drawTextRelative(-1, 0, "Long", Color.black, Color.lime, Text.VCENTER | Text.BOLD | Text.PRESET, null, null, "Txt" + getValue("time"));
}
}
}
if (Strategy.isLong()) setBarBgColor(Color.lightgrey);
return new Array(ndiffsell, ndiffbuy, nCloseGreaterSMA10);
}
function StdDev(nLength, xSeries) {
var sum = 0;
var avg = 0;
var res = 0;
if (xSeries.getValue(0) == null) return;
for (var barsBack = nLength-1; barsBack >= 0; barsBack--) {
sum += xSeries.getValue(barsBack*(-1));
}
avg = sum / nLength;
sum = 0;
for (var barsBack = nLength - 1; barsBack >= 0; barsBack--) {
sum += (xSeries.getValue(barsBack*(-1))-avg)*(xSeries.getValue(barsBack*(-1))-avg);
}
res = Math.sqrt(sum / nLength);
return res;
}
function verify() {
var b = false;
if (getBuildNumber() < 779) {
drawTextAbsolute(5, 35, "This study requires version 8.0 or later.",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "error");
drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp",
Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
null, 13, "upgrade");
return b;
} else {
b = true;
}
return b;
}