File Name: eSignal_HeikinAshi.efs
Description:
Based on Using The Heikin-Ashi Technique by Dan Valcu. This article appeared in the February 2004 issue of Stock & Commodities. The main formula is eSignal_HeikinAshi.efs. There are two other indicators from the article, which are also included below (eSignal_HA_OC.efs and eSignal_HADiffCO.efs).
Formula Parameters:
eSignal_HeikinAshi.efs
Bullish Candles (Color): Green
Bearish Candles (Color): Red
eSignal_HA_OC.efs
HA-Open Color: Red
HA-Close Color: Blue
HA-Open Thickness: 2
HA-Close Thickness: 2
Enable Alerts: true
Enable Forex Conversion: false
Forex Conversion Factor: 100000
eSignal_HADiffCO.efs
SMA Periods: 3
HA-DiffCO Color: Blue
SMA HA-DiffCO Color: Red
HA-DiffCO Thickness: 2
SMA HA-DiffCO Thickness: 2
Enable Alerts: true
Enable Forex Conversion: false
Forex Conversion Factor: 100000
Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
7/28/2004 - eSignal_HA_OC.efs and eSignal_HA_DiffCO.efs Versions 1.1 now include alert arrows for crosses and Edit Studies options for disabling alerts as well as Forex price conversion and the Forex conversion factor.
Download File:
eSignal_HeikinAshi.efs
eSignal_HA_OC.efs Version 1.1 7/28/2004
eSignal_HA_DiffCO.efs Version 1.1 7/28/2004
EFS Code:
eSignal_HeikinAshi.efs
eSignal_HA_OC.efs
eSignal_HADiffCO.efs
Description:
Based on Using The Heikin-Ashi Technique by Dan Valcu. This article appeared in the February 2004 issue of Stock & Commodities. The main formula is eSignal_HeikinAshi.efs. There are two other indicators from the article, which are also included below (eSignal_HA_OC.efs and eSignal_HADiffCO.efs).
Formula Parameters:
eSignal_HeikinAshi.efs
Bullish Candles (Color): Green
Bearish Candles (Color): Red
eSignal_HA_OC.efs
HA-Open Color: Red
HA-Close Color: Blue
HA-Open Thickness: 2
HA-Close Thickness: 2
Enable Alerts: true
Enable Forex Conversion: false
Forex Conversion Factor: 100000
eSignal_HADiffCO.efs
SMA Periods: 3
HA-DiffCO Color: Blue
SMA HA-DiffCO Color: Red
HA-DiffCO Thickness: 2
SMA HA-DiffCO Thickness: 2
Enable Alerts: true
Enable Forex Conversion: false
Forex Conversion Factor: 100000
Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
7/28/2004 - eSignal_HA_OC.efs and eSignal_HA_DiffCO.efs Versions 1.1 now include alert arrows for crosses and Edit Studies options for disabling alerts as well as Forex price conversion and the Forex conversion factor.
Download File:
eSignal_HeikinAshi.efs
eSignal_HA_OC.efs Version 1.1 7/28/2004
eSignal_HA_DiffCO.efs Version 1.1 7/28/2004
EFS Code:
eSignal_HeikinAshi.efs
PHP Code:
/*********************************
Provided By : eSignal. (c) Copyright 2003
EFS Formula : Heikin-Ashi
Notes:
* Non-price study
* Draws most recent 200 bars
* Formula Parameters
- Bullish Color Default: Green
- Bearish Color Default: Red
*********************************/
function preMain() {
setStudyTitle("Heikin-Ashi Chart ");
setCursorLabelName("HA-High", 0);
setCursorLabelName("HA-Low", 1);
setCursorLabelName("HA-Open", 2);
setCursorLabelName("HA-Close", 3);
setDefaultBarFgColor(Color.black, 0);
setDefaultBarFgColor(Color.black, 1);
setDefaultBarFgColor(Color.black, 2);
setDefaultBarFgColor(Color.black, 3);
setPlotType(PLOTTYPE_DOT, 0);
setPlotType(PLOTTYPE_DOT, 1);
setPlotType(PLOTTYPE_DOT, 2);
setPlotType(PLOTTYPE_DOT, 3);
setDefaultBarThickness(0, 0);
setDefaultBarThickness(0, 1);
setDefaultBarThickness(0, 2);
setDefaultBarThickness(0, 3);
var fp1 = new FunctionParameter("cBull", FunctionParameter.COLOR);
fp1.setName("Bullish Candles");
fp1.setDefault(Color.green);
var fp2 = new FunctionParameter("cBear", FunctionParameter.COLOR);
fp2.setName("Bearish Candles");
fp2.setDefault(Color.red);
}
var haClose = null;
var haOpen = null;
var haClose1 = null;
var haOpen1 = null;
var iCntr = 0;
function main(cBull, cBear) {
var nState = getBarState();
if (nState == BARSTATE_NEWBAR) {
if ((haClose == null || haOpen == null) && close(-1) != null) {
haClose = close(-1);
haOpen = open(-1);
}
haClose1 = haClose;
haOpen1 = haOpen;
iCntr += 1;
if (iCntr > 200) iCntr = 0;
}
if (haClose1 == null || haOpen1 == null) return;
haOpen = (haOpen1 + haClose1) / 2;
haClose = (open() + high() + low() + close()) / 4;
var haHigh = Math.max(high(), haOpen, haClose);
var haLow = Math.min(low(), haOpen, haClose);
//candlesticks
var vColor = Color.black;
if (haClose > haOpen) vColor = cBull;
if (haClose < haOpen) vColor = cBear;
setBarFgColor(vColor, 2);
setBarFgColor(vColor, 3);
drawLineRelative(0, haHigh, 0, haLow, PS_SOLID, 1, Color.black, "Shadow"+iCntr);
drawLineRelative(0, haOpen, 0, haClose, PS_SOLID, 3, vColor, "Body"+iCntr);
var retArray = new Array(4);
retArray[0] = haHigh.toFixed(2)*1;
retArray[1] = haLow.toFixed(2)*1;
retArray[2] = haOpen.toFixed(2)*1;
retArray[3] = haClose.toFixed(2)*1;
return retArray;
}
PHP Code:
/*********************************
Provided By : eSignal. (c) Copyright 2003
EFS Formula : Heikin-Ashi Open Close Indicator
Version 1.1 7/28/2004
1.1
* Added Alert Arrows on MA cross.
* Added Option to disable Alerts
* Added Option for Forex Price Conversion and Conversion Factor
Notes:
* Non-price study
* Formula Parameters
- HA-Open Color Default: Red
- HA-Close Color Default: Blue
- HA-Open Thickness Default: 2
- HA-Close Thickness Default: 2
- Enable Alerts Default: true
- Enabel Forex Conversion Default: false
- Forex Conversion Factor Default: 100000
*********************************/
function preMain() {
setStudyTitle("Heikin-Ashi Open Close Indicator ");
setCursorLabelName("HA-Open", 0);
setCursorLabelName("HA-Close", 1);
setShowTitleParameters(false);
var fp1 = new FunctionParameter("cOpen", FunctionParameter.COLOR);
fp1.setName("HA-Open Color");
fp1.setDefault(Color.red);
var fp2 = new FunctionParameter("cClose", FunctionParameter.COLOR);
fp2.setName("HA-Close Color");
fp2.setDefault(Color.blue);
var fp3 = new FunctionParameter("nOThickness", FunctionParameter.NUMBER);
fp3.setName("HA-Open Thickness");
fp3.setLowerLimit(1);
fp3.setDefault(2);
var fp4 = new FunctionParameter("nCThickness", FunctionParameter.NUMBER);
fp4.setName("HA-Close Thickness");
fp4.setLowerLimit(1);
fp4.setDefault(2);
var fp5 = new FunctionParameter("bAlerts", FunctionParameter.BOOLEAN);
fp5.setName("Enable Alerts");
fp5.setDefault(true);
var fp6 = new FunctionParameter("bForex", FunctionParameter.BOOLEAN);
fp6.setName("Enable Forex Conversion");
fp6.setDefault(false);
var fp7 = new FunctionParameter("nFactor", FunctionParameter.NUMBER);
fp7.setName("Forex Conversion Factor");
fp7.setLowerLimit(1);
fp7.setDefault(100000);
}
var haClose = null;
var haOpen = null;
var haClose1 = null;
var haOpen1 = null;
var bEdit = true;
var cntr = 0;
function main(cOpen, cClose, nOThickness, nCThickness, bAlerts,
bForex, nFactor) {
var nState = getBarState();
if (bEdit == true) {
setDefaultBarFgColor(cOpen, 0);
setDefaultBarFgColor(cClose, 1);
setDefaultBarThickness(nOThickness, 0);
setDefaultBarThickness(nCThickness, 1);
bEdit = false;
}
if (nState == BARSTATE_NEWBAR) {
cntr++;
if ((haClose == null || haOpen == null) && close(-1) != null) {
haClose = close(-1);
haOpen = open(-1);
}
haClose1 = haClose;
haOpen1 = haOpen;
}
if (haClose1 == null || haOpen1 == null) return;
haOpen = (haOpen1 + haClose1) / 2;
haClose = (open() + high() + low() + close()) / 4;
if (bForex == false || bForex == "false") nFactor = 1;
var retArray = new Array(2);
retArray[0] = (haOpen*nFactor).toFixed(2)*1;
retArray[1] = (haClose*nFactor).toFixed(2)*1;
// Alerts
if (haClose1 != null && haOpen1 != null && (bAlerts == true || bAlerts == "true") ) {
if (haClose1 < haOpen1 && haClose > haOpen) { // Up Arrow
drawShapeRelative(0, haClose1*nFactor, Shape.UPARROW, null, Color.lime,
Shape.TOP|Shape.ONTOP, "arrow"+cntr);
} else if (haClose1 > haOpen1 && haClose < haOpen) { // Down Arrow
drawShapeRelative(0, haClose1*nFactor, Shape.DOWNARROW, null, Color.maroon,
Shape.BOTTOM|Shape.ONTOP, "arrow"+cntr);
} else {
removeShape("arrow"+cntr);
}
}
return retArray;
}
PHP Code:
/*********************************
Provided By : eSignal. (c) Copyright 2003
EFS Formula : Heikin-Ashi DiffCO Indicator
Version 1.1 7/28/2004
1.1
* Added Alert Arrows on MA cross.
* Added Option to disable Alerts
* Added Option for Forex Price Conversion and Conversion Factor
Notes:
* Non-price study
* Formula Parameters
- SMA Periods Default: 3
- HA-DiffCO Color Default: Blue
- SMA HA-DiffCO Color Default: Red
- HA-DiffCO Thickness Default: 2
- SMA HA-DiffCO Thickness Default: 2
- Enable Alerts Default: true
- Enable Forex Conversion Default: false
- Forex Conversion Factor Default: 100000
*********************************/
function preMain() {
setStudyTitle("Heikin-Ashi DiffCO Indicator ");
setCursorLabelName("HA-DiffCO", 0);
setCursorLabelName("SMA HA-DiffCO", 1);
setShowTitleParameters(false);
var fp0 = new FunctionParameter("nLength", FunctionParameter.NUMBER);
fp0.setName("SMA Periods");
fp0.setLowerLimit(1);
fp0.setDefault(3);
var fp1 = new FunctionParameter("cDiffCO", FunctionParameter.COLOR);
fp1.setName("HA-DiffCO Color");
fp1.setDefault(Color.blue);
var fp2 = new FunctionParameter("cMADiffCO", FunctionParameter.COLOR);
fp2.setName("SMA HA-DiffCO Color");
fp2.setDefault(Color.red);
var fp3 = new FunctionParameter("nDThickness", FunctionParameter.NUMBER);
fp3.setName("HA-DiffCO Thickness");
fp3.setLowerLimit(1);
fp3.setDefault(2);
var fp4 = new FunctionParameter("nMAThickness", FunctionParameter.NUMBER);
fp4.setName("SMA HA-DiffCO Thickness");
fp4.setLowerLimit(1);
fp4.setDefault(2);
var fp5 = new FunctionParameter("bAlerts", FunctionParameter.BOOLEAN);
fp5.setName("Enable Alerts");
fp5.setDefault(true);
var fp6 = new FunctionParameter("bForex", FunctionParameter.BOOLEAN);
fp6.setName("Enable Forex Conversion");
fp6.setDefault(false);
var fp7 = new FunctionParameter("nFactor", FunctionParameter.NUMBER);
fp7.setName("Forex Conversion Factor");
fp7.setLowerLimit(1);
fp7.setDefault(100000);
}
var haClose = null;
var haOpen = null;
var haClose1 = null;
var haOpen1 = null;
var bEdit = true;
var aDiffCO = null;
var haDiffCO = null;
var haDiffCO_1 = null;
var vMA = null;
var vMA_1 = null;
var cntr = 0;
function main(nLength, cDiffCO, cMADiffCO, nDThickness, nMAThickness, bAlerts,
bForex, nFactor) {
var nState = getBarState();
var i = 0;
var dSum = 0;
if (bEdit == true) {
setDefaultBarFgColor(cDiffCO, 0);
setDefaultBarFgColor(cMADiffCO, 1);
setDefaultBarThickness(nDThickness, 0);
setDefaultBarThickness(nMAThickness, 1);
aDiffCO = new Array(nLength);
bEdit = false;
}
if (nState == BARSTATE_NEWBAR) {
cntr++;
if ((haClose == null || haOpen == null) && close(-1) != null) {
haClose = close(-1);
haOpen = open(-1);
}
haClose1 = haClose;
haOpen1 = haOpen;
if (haDiffCO != null) {
aDiffCO.pop();
aDiffCO.unshift(haDiffCO);
haDiffCO_1 = haDiffCO;
}
vMA_1 = vMA;
}
if (haClose1 == null || haOpen1 == null) return;
haOpen = (haOpen1 + haClose1) / 2;
haClose = (open() + high() + low() + close()) / 4;
haDiffCO = (haClose - haOpen);
aDiffCO[0] = haDiffCO;
vMA = null;
if (aDiffCO[nLength-1] != null) {
for (i = 0; i < nLength; ++i) {
dSum += aDiffCO[i];
}
vMA = (dSum / nLength);
}
if (bForex == false || bForex == "false") nFactor = 1;
var retArray = new Array(2);
retArray[0] = (haDiffCO*nFactor).toFixed(2)*1;
retArray[1] = vMA*nFactor;
// Alerts
if (haDiffCO_1 != null && vMA_1 != null && (bAlerts == true || bAlerts == "true") ) {
if (haDiffCO_1 < vMA_1 && haDiffCO > vMA) { // Up Arrow
drawShapeRelative(0, haDiffCO_1*nFactor, Shape.UPARROW, null, Color.lime,
Shape.TOP|Shape.ONTOP, "arrow"+cntr);
} else if (haDiffCO_1 > vMA_1 && haDiffCO < vMA) { // Down Arrow
drawShapeRelative(0, haDiffCO_1*nFactor, Shape.DOWNARROW, null, Color.maroon,
Shape.BOTTOM|Shape.ONTOP, "arrow"+cntr);
} else {
removeShape("arrow"+cntr);
}
}
return retArray;
}