Is anyone aware of an EFS in the forums for MACD which uses double or triple smoothed EMAs instead of the standard EMAs? Or how I can modify the existing eSignal EFS for MACD to do this? I've had a search of the forums but have been unable to find anything. Many thanks.
Announcement
Collapse
No announcement yet.
Modified MACD
Collapse
X
-
Re: Modified MACD
Originally posted by eurotrader1
Is anyone aware of an EFS in the forums for MACD which uses double or triple smoothed EMAs instead of the standard EMAs? Or how I can modify the existing eSignal EFS for MACD to do this? I've had a search of the forums but have been unable to find anything. Many thanks.
PHP Code:var fpArray = new Array();
var bInit = false;
function preMain() {
setPriceStudy(false);
setShowCursorLabel(false);
setShowTitleParameters( false );
setStudyTitle("Modified MACD");
setCursorLabelName("Zero", 0);
setCursorLabelName("MACD", 1);
setCursorLabelName("MACDSig", 2);
setCursorLabelName("MACDHist", 3);
setDefaultBarFgColor(Color.black, 0);
setDefaultBarFgColor(Color.blue, 1);
setDefaultBarFgColor(Color.red, 2);
setDefaultBarFgColor(Color.magenta, 3);
setPlotType(PLOTTYPE_LINE, 0);
setPlotType(PLOTTYPE_LINE, 1);
setPlotType(PLOTTYPE_LINE, 2);
setPlotType(PLOTTYPE_HISTOGRAM, 3);
setDefaultBarThickness(1, 0);
setDefaultBarThickness(1, 1);
setDefaultBarThickness(1, 2);
setDefaultBarThickness(1, 3);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Display Cursor Labels");
setDefault(false);
}
fpArray[x] = new FunctionParameter("ShowTitleParameters", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Title Parameters");
setDefault(false);
}
fpArray[x] = new FunctionParameter("FastLength", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(12);
}
fpArray[x] = new FunctionParameter("SlowLength", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(26);
}
fpArray[x] = new FunctionParameter("MACDLength", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(9);
}
fpArray[x] = new FunctionParameter("Thickness", FunctionParameter.NUMBER);
with(fpArray[x++]){
setName("Line Thickness");
setLowerLimit(1);
setDefault(1);
}
}
var xMyMACD = null;
var xMACDAvg = null;
var xMACDDiff = null;
var xFastMA = null;
var xSlowMA = null;
function main(FastLength, SlowLength, MACDLength, Thickness, ShowTitleParameters, ViewValue) {
var nMACD = 0;
var nMACDAvg = 0;
var nMACDDiff = 0;
if ( bInit == false ) {
setDefaultBarThickness(Thickness, 0);
setDefaultBarThickness(Thickness, 1);
setDefaultBarThickness(Thickness, 2);
setDefaultBarThickness(Thickness, 3);
setShowCursorLabel(ViewValue);
setShowTitleParameters( ShowTitleParameters );
xFastMA = ema(FastLength);
xSlowMA = ema(SlowLength);
xFastMA = ema(FastLength, xFastMA);
xSlowMA = ema(SlowLength, xSlowMA);
xMyMACD = efsInternal("Calc_MyMACD", xFastMA, xSlowMA);
xMACDAvg = ema(MACDLength, xMyMACD);
xMACDDiff = efsInternal("Calc_MACDDiff", xMyMACD, xMACDAvg);
bInit = true;
}
nMACD = xMyMACD.getValue(0);
nMACDAvg = xMACDAvg.getValue(0);
nMACDDiff = xMACDDiff.getValue(0);
return new Array(0 , nMACD, nMACDAvg, nMACDDiff);
}
function Calc_MyMACD(xFastMA, xSlowMA) {
var nRes = 0;
nRes = xFastMA.getValue(0) - xSlowMA.getValue(0);
if (nRes == null) nRes = 1;
return nRes;
}
function Calc_MACDDiff(xMyMACD, xMACDAvg) {
var nRes = 0;
nRes = xMyMACD.getValue(0) - xMACDAvg.getValue(0);
if (nRes == null) nRes = 1;
return nRes;
}
Comment