File Names: TEMA.efs, ZeroLag_TEMA.efs, HA_ZeroLag_TEMA.efs, ZeroLag_HA_Tema_Cross.efs
Description:
These studies are based on the May 2008 article, The Quest For Reliable Cross-overs, by Sylvain Vervoort.
Formula Parameters:
TEMA.efs:
Periods: 10
Price Source: Close [Close, HL/2, HLC/3, OHLC/4]
ZeroLag_TEMA.efs:
Periods: 10
Price Source: Close [Close, HL/2, HLC/3, OHLC/4]
HA_ZeroLag_TEMA.efs:
Periods: 10
ZeroLag_HA_Tema_Cross.efs:
Periods: 55
Zero Lag TEMA Price Source: HLC/3 [Close, HL/2, HLC/3, OHLC/4]
Long Only: false
Notes:
The Zero Lag EMA study mentioned in the article can be found in the Feb. 2008 EFS KnowledgeBase article published here. The original Heiken-Ashi study mentioned in the article can be found in the Feb 2004 EFS KnowledgeBase article here. Also, the ZeroLag_HA_Tema_Cross.efs contains a formula parameter (Long Only) to force the strategy to allow only long trades, which is also configured for back testing with the Strategy Analyzer. The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
TEMA.efs
ZeroLag_TEMA.efs
HA_ZeroLag_TEMA.efs
ZeroLag_HA_Tema_Cross.efs
EFS Code:
TEMA.efs
ZeroLag_TEMA.efs
HA_ZeroLag_TEMA.efs
ZeroLag_HA_Tema_Cross.efs
Description:
These studies are based on the May 2008 article, The Quest For Reliable Cross-overs, by Sylvain Vervoort.
Formula Parameters:
TEMA.efs:
Periods: 10
Price Source: Close [Close, HL/2, HLC/3, OHLC/4]
ZeroLag_TEMA.efs:
Periods: 10
Price Source: Close [Close, HL/2, HLC/3, OHLC/4]
HA_ZeroLag_TEMA.efs:
Periods: 10
ZeroLag_HA_Tema_Cross.efs:
Periods: 55
Zero Lag TEMA Price Source: HLC/3 [Close, HL/2, HLC/3, OHLC/4]
Long Only: false
Notes:
The Zero Lag EMA study mentioned in the article can be found in the Feb. 2008 EFS KnowledgeBase article published here. The original Heiken-Ashi study mentioned in the article can be found in the Feb 2004 EFS KnowledgeBase article here. Also, the ZeroLag_HA_Tema_Cross.efs contains a formula parameter (Long Only) to force the strategy to allow only long trades, which is also configured for back testing with the Strategy Analyzer. The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
TEMA.efs
ZeroLag_TEMA.efs
HA_ZeroLag_TEMA.efs
ZeroLag_HA_Tema_Cross.efs
EFS Code:
TEMA.efs
PHP Code:
/*********************************
Provided By:
eSignal (Copyright © eSignal), a division of Interactive Data
Corporation. 2008. 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: The Quest For Reliable Crossovers
by Sylvain Vervoort
Version: 1.0 3/11/2008
Notes:
* May 2008 Issue of Stocks and Commodities Magazine
* Study requires version 8.0 or later.
Formula Parameters: Defaults:
Periods 10
Price Source Close [Close, HL/2, HLC/3, OHLC/4]
**********************************/
function preMain() {
setPriceStudy(true);
setStudyTitle("TEMA ");
setCursorLabelName("TEMA", 0);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarThickness(2, 0);
var fp1 = new FunctionParameter("nPeriods", FunctionParameter.NUMBER);
fp1.setName("Periods");
fp1.setLowerLimit(0);
fp1.setDefault(10);
var fp2 = new FunctionParameter("sSource", FunctionParameter.STRING);
fp2.setName("Price Source");
fp2.addOption("Close");
fp2.addOption("HA Close");
fp2.setDefault("Close");
}
// Global Variables
var bVersion = null; // Version flag
var bInit = false; // Initialization flag
var xTema = null;
var xHaOpen = null;
var xHaClose = null;
function main(nPeriods, sSource) {
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if (bInit == false) {
xHaOpen = efsInternal("calcHaOpen");
xHaClose = efsInternal("calcHaClose", xHaOpen);
if (sSource == "Close") {
xSource = close();
} else {
xSource = xHaClose;
}
xTema = efsInternal("calcTEMA", nPeriods, xSource);
bInit = true;
}
var nTema = xTema.getValue(0);
if (nTema == null) return;
return nTema;
}
// HaOpen globals
var nHaOpen = null;
var nHaOpen_1 = null;
function calcHaOpen() {
if (nHaOpen_1 == null && open(-1) != null) {
nHaOpen_1 = open(-1);
} else if (nHaOpen != null) {
nHaOpen_1 = nHaOpen;
}
if (nHaOpen_1 == null) return;
var nC_1 = sma(1, ohlc4(), -1);
if (nC_1 == null) return;
nHaOpen = (nC_1 + nHaOpen_1) / 2;
return nHaOpen;
}
function calcHaClose(xHaO) {
var n4 = sma(1, ohlc4(), 0);
var nHaO = xHaO.getValue(0);
if (n4 == null || nHaO == null) return;
var nHaCl = (n4 + nHaO +
Math.max(n4, high(0), nHaO) +
Math.min(n4, low(0), nHaO ) ) / 4;
return nHaCl;
}
// TEMA globals
var xAvg1 = null;
var xAvg2 = null;
var xAvg3 = null;
var bInit2 = false;
function calcTEMA(nLength, xSrc){
if(bInit2 == false){
xAvg1 = ema(nLength, xSrc);
xAvg2 = ema(nLength,xAvg1);
xAvg3 = ema(nLength,xAvg2);
bInit2 = true;
}
var nAvg1 = xAvg1.getValue(0);
var nAvg2 = xAvg2.getValue(0);
var nAvg3 = xAvg3.getValue(0);
if (nAvg1 == null || nAvg2 == null || nAvg3 == null) return;
var nTEMA = (3*nAvg1)-(3*nAvg2)+nAvg3;
return nTEMA;
}
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;
}
PHP Code:
/*********************************
Provided By:
eSignal (Copyright © eSignal), a division of Interactive Data
Corporation. 2008. 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: The Quest For Reliable Crossovers
by Sylvain Vervoort
Version: 1.0 3/11/2008
Notes:
* May 2008 Issue of Stocks and Commodities Magazine
* Study requires version 8.0 or later.
Formula Parameters: Defaults:
Periods 10
Price Source Close [Close, HL/2, HLC/3, OHLC/4]
**********************************/
function preMain() {
setPriceStudy(true);
setStudyTitle("Zero Lag TEMA ");
setCursorLabelName("ZTEMA", 0);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(2, 0);
var fp1 = new FunctionParameter("nPeriods", FunctionParameter.NUMBER);
fp1.setName("Periods");
fp1.setLowerLimit(1);
fp1.setDefault(10);
var fp2 = new FunctionParameter("sSource", FunctionParameter.STRING);
fp2.setName("Price Source");
fp2.addOption("Close");
fp2.addOption("HL/2");
fp2.addOption("HLC/3");
fp2.addOption("OHLC/4");
fp2.setDefault("Close");
}
// Global Variables
var bVersion = null; // Version flag
var bInit = false; // Initialization flag
var xTema1 = null;
var xTema2 = null;
var xSource = null;
function main(nPeriods, sSource) {
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if (bInit == false) {
if (sSource == "Close") {
xSource = close();
} else if (sSource == "HL/2") {
xSource = hl2();
} else if (sSource == "HLC/3") {
xSource = hlc3();
} else if (sSource == "OHLC/4") {
xSource = ohlc4();
}
xTema1 = efsInternal("calcTEMA", nPeriods, xSource);
xTema2 = efsInternal("calcTEMA", nPeriods, xTema1);
bInit = true;
}
var nZEma = null;
var nTema1 = xTema1.getValue(0);
var nTema2 = xTema2.getValue(0);
if (nTema1 == null || nTema2 == null) return;
nZTEma = nTema1 + (nTema1 - nTema2);
return nZTEma;
}
// TEMA globals
var xAvg1 = null;
var xAvg2 = null;
var xAvg3 = null;
var bInit2 = false;
function calcTEMA(nLength,xSource){
if(bInit2 == false){
xAvg1 = ema(nLength,xSource);
xAvg2 = ema(nLength,xAvg1);
xAvg3 = ema(nLength,xAvg2);
bInit2 = true;
}
var nAvg1 = xAvg1.getValue(0);
var nAvg2 = xAvg2.getValue(0);
var nAvg3 = xAvg3.getValue(0);
if (nAvg1 == null || nAvg2 == null || nAvg3 == null) return;
var nTEMA = (3*nAvg1)-(3*nAvg2)+nAvg3;
return nTEMA;
}
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;
}
PHP Code:
/*********************************
Provided By:
eSignal (Copyright © eSignal), a division of Interactive Data
Corporation. 2008. 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: The Quest For Reliable Crossovers
by Sylvain Vervoort
Version: 1.0 3/11/2008
Notes:
* May 2008 Issue of Stocks and Commodities Magazine
* Study requires version 8.0 or later.
Formula Parameters: Defaults:
Periods 10
**********************************/
function preMain() {
setPriceStudy(true);
setStudyTitle("HA Zero Lag TEMA ");
setCursorLabelName("HA ZTEMA", 0);
setDefaultBarFgColor(Color.green, 0);
setDefaultBarThickness(2, 0);
var fp1 = new FunctionParameter("nPeriods", FunctionParameter.NUMBER);
fp1.setName("Periods");
fp1.setLowerLimit(1);
fp1.setDefault(10);
}
// Global Variables
var bVersion = null; // Version flag
var bInit = false; // Initialization flag
var xTema1 = null;
var xTema2 = null;
var xHaOpen = null;
var xHaClose = null;
function main(nPeriods) {
if (bVersion == null) bVersion = verify();
if (bVersion == false) return;
if (bInit == false) {
xHaOpen = efsInternal("calcHaOpen");
xHaClose = efsInternal("calcHaClose", xHaOpen);
xTema1 = efsInternal("calcTEMA", nPeriods, xHaClose);
xTema2 = efsInternal("calcTEMA", nPeriods, xTema1);
bInit = true;
}
var nHAZEma = null;
var nTema1 = xTema1.getValue(0);
var nTema2 = xTema2.getValue(0);
if (nTema1 == null || nTema2 == null) return;
nHAZTEma = nTema1 + (nTema1 - nTema2);
return nHAZTEma;
}
// HaOpen globals
var nHaOpen = null;
var nHaOpen_1 = null;
function calcHaOpen() {
if (nHaOpen_1 == null && open(-1) != null) {
nHaOpen_1 = open(-1);
} else if (nHaOpen != null) {
nHaOpen_1 = nHaOpen;
}
if (nHaOpen_1 == null) return;
var nC_1 = sma(1, ohlc4(), -1);
if (nC_1 == null) return;
nHaOpen = (nC_1 + nHaOpen_1) / 2;
return nHaOpen;
}
function calcHaClose(xHaO) {
var n4 = sma(1, ohlc4(), 0);
var nHaO = xHaO.getValue(0);
if (n4 == null || nHaO == null) return;
var nHaCl = (n4 + nHaO +
Math.max(n4, high(0), nHaO) +
Math.min(n4, low(0), nHaO ) ) / 4;
return nHaCl;
}
// TEMA globals
var xAvg1 = null;
var xAvg2 = null;
var xAvg3 = null;
var bInit2 = false;
function calcTEMA(nLength,xSource){
if(bInit2 == false){
xAvg1 = ema(nLength,xSource);
xAvg2 = ema(nLength,xAvg1);
xAvg3 = ema(nLength,xAvg2);
bInit2 = true;
}
var nAvg1 = xAvg1.getValue(0);
var nAvg2 = xAvg2.getValue(0);
var nAvg3 = xAvg3.getValue(0);
if (nAvg1 == null || nAvg2 == null || nAvg3 == null) return;
var nTEMA = (3*nAvg1)-(3*nAvg2)+nAvg3;
return nTEMA;
}
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;
}
PHP Code:
/*
Due to message length limit in the forums the code for this study
has been omitted. Please open the formula in the EFS Editor from the download link to view the code.
*/