Hi There,
I would appreciate if someone can help to modify "Impulse CD" esf by add some extra plot colour, the current one only show Green and Red like picture1. I do need extra plot colour to looks like picture 2 , it would make it easy to catch the eye ball when price start pullback. I won't used the ( Impulse Macd) and (Impulse Signal).
Modify Impulse CD colour.
IF Histogram above zero level colour in ( GREEN )
IF Histogram above zero, and Bullish Retrace colour in ( WHITE )
IF Histogram below zero level colour in( RED )
Histogram below zero, and Bearish Retrace colour in ( WHITE )
Picture 1 .................................................. ....... Picture 2....................
Description:
Impulse CD Color
Version: 1.0 08/26/2009
Formula Parameters: Default:
Slow MA 34
Fast MA 14
Signal MA 9
Notes:
**********************************/
var fpArray = new Array();
var bInit = false;
function preMain(){
setPriceStudy(false);
setShowCursorLabel(true);
setShowTitleParameters(false);
setStudyTitle("Impulse CD");
setCursorLabelName("Impulse MACD", 0);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_HISTOGRAM, 0);
setDefaultBarThickness(2,0);
setCursorLabelName("Signal", 1);
setDefaultBarFgColor(Color.red, 1);
setPlotType(PLOTTYPE_LINE, 1);
setDefaultBarThickness(2,1);
setCursorLabelName("Impulse CD", 2);
setDefaultBarFgColor(Color.green, 2);
setPlotType(PLOTTYPE_HISTOGRAM, 2);
setDefaultBarThickness(2,2);
var x = 0;
fpArray[x] = new FunctionParameter("SlowMA", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setName("Slow MA");
setLowerLimit(1);
setDefault(34);
}
fpArray[x] = new FunctionParameter("FastMA", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setName("Fast MA");
setLowerLimit(1);
setDefault(14);
}
fpArray[x] = new FunctionParameter("SignalMA", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setName("Signal MA");
setLowerLimit(1);
setDefault(9);
}
}
var xImpulseCD = null;
var xMACDDivr = null;
var xSignalMACDDivr = null;
var xColor = null;
function main(SlowMA, FastMA, SignalMA) {
var nBarState = getBarState();
var nImpulseCD = 0;
var nMACDDivr = 0;
var nSignalMACDDivr = 0;
if (nBarState == BARSTATE_ALLBARS) {
if(SlowMA == null) SlowMA = 34;
if(FastMA == null) FastMA = 14;
if(SignalMA == null) SignalMA = 9;
}
if (bInit == false) {
addBand(0, PS_SOLID, 1, Color.black, "ZeroLine");
xImpulseCD = efsInternal("Calc_ImpulseCD", SlowMA, FastMA, SignalMA);
xMACDDivr = getSeries(xImpulseCD, 1);
xSignalMACDDivr = getSeries(xImpulseCD, 2);
xColor = getSeries(xImpulseCD, 3);
bInit = true;
}
nImpulseCD = xImpulseCD.getValue(0);
nMACDDivr = xMACDDivr.getValue(0);
nSignalMACDDivr = xSignalMACDDivr.getValue(0);
if (nMACDDivr == null) return;
setBarFgColor(xColor.getValue(0), 2);
return new Array(nMACDDivr, nSignalMACDDivr, nImpulseCD);
}
var bSecondInit = false;
var xMACDDivBuff = null;
var xMA_MACDDivBuff = null;
function Calc_ImpulseCD(SlowMA, FastMA, SignalMA) {
var nRes = 0;
var cColor = Color.green;
var nMACDDivBuff = 0;
var nMA_MACDDivBuff = 0;
var nMACDDivBuff1 = 0;
var nMA_MACDDivBuff1 = 0;
if (!bSecondInit) {
xMACDDivBuff = macd(FastMA, SlowMA, 1);
xMA_MACDDivBuff = sma(SignalMA, xMACDDivBuff);
bSecondINit = true;
}
nMACDDivBuff = xMACDDivBuff.getValue(0);
nMA_MACDDivBuff = xMA_MACDDivBuff.getValue(0);
nMACDDivBuff1 = xMACDDivBuff.getValue(-1);
nMA_MACDDivBuff1 = xMA_MACDDivBuff.getValue(-1);
if (nMA_MACDDivBuff1 == null) return;
nRes = nMACDDivBuff - nMA_MACDDivBuff;
if ((nMACDDivBuff - nMA_MACDDivBuff) > (nMACDDivBuff1 - nMA_MACDDivBuff1)) cColor = Color.green;
if ((nMACDDivBuff - nMA_MACDDivBuff) < (nMACDDivBuff1 - nMA_MACDDivBuff1)) cColor = Color.red;
return new Array(nRes, nMACDDivBuff, nMA_MACDDivBuff, cColor);
Regards,
Steven
I would appreciate if someone can help to modify "Impulse CD" esf by add some extra plot colour, the current one only show Green and Red like picture1. I do need extra plot colour to looks like picture 2 , it would make it easy to catch the eye ball when price start pullback. I won't used the ( Impulse Macd) and (Impulse Signal).
Modify Impulse CD colour.
IF Histogram above zero level colour in ( GREEN )
IF Histogram above zero, and Bullish Retrace colour in ( WHITE )
IF Histogram below zero level colour in( RED )
Histogram below zero, and Bearish Retrace colour in ( WHITE )
Picture 1 .................................................. ....... Picture 2....................
Description:
Impulse CD Color
Version: 1.0 08/26/2009
Formula Parameters: Default:
Slow MA 34
Fast MA 14
Signal MA 9
Notes:
**********************************/
var fpArray = new Array();
var bInit = false;
function preMain(){
setPriceStudy(false);
setShowCursorLabel(true);
setShowTitleParameters(false);
setStudyTitle("Impulse CD");
setCursorLabelName("Impulse MACD", 0);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_HISTOGRAM, 0);
setDefaultBarThickness(2,0);
setCursorLabelName("Signal", 1);
setDefaultBarFgColor(Color.red, 1);
setPlotType(PLOTTYPE_LINE, 1);
setDefaultBarThickness(2,1);
setCursorLabelName("Impulse CD", 2);
setDefaultBarFgColor(Color.green, 2);
setPlotType(PLOTTYPE_HISTOGRAM, 2);
setDefaultBarThickness(2,2);
var x = 0;
fpArray[x] = new FunctionParameter("SlowMA", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setName("Slow MA");
setLowerLimit(1);
setDefault(34);
}
fpArray[x] = new FunctionParameter("FastMA", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setName("Fast MA");
setLowerLimit(1);
setDefault(14);
}
fpArray[x] = new FunctionParameter("SignalMA", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setName("Signal MA");
setLowerLimit(1);
setDefault(9);
}
}
var xImpulseCD = null;
var xMACDDivr = null;
var xSignalMACDDivr = null;
var xColor = null;
function main(SlowMA, FastMA, SignalMA) {
var nBarState = getBarState();
var nImpulseCD = 0;
var nMACDDivr = 0;
var nSignalMACDDivr = 0;
if (nBarState == BARSTATE_ALLBARS) {
if(SlowMA == null) SlowMA = 34;
if(FastMA == null) FastMA = 14;
if(SignalMA == null) SignalMA = 9;
}
if (bInit == false) {
addBand(0, PS_SOLID, 1, Color.black, "ZeroLine");
xImpulseCD = efsInternal("Calc_ImpulseCD", SlowMA, FastMA, SignalMA);
xMACDDivr = getSeries(xImpulseCD, 1);
xSignalMACDDivr = getSeries(xImpulseCD, 2);
xColor = getSeries(xImpulseCD, 3);
bInit = true;
}
nImpulseCD = xImpulseCD.getValue(0);
nMACDDivr = xMACDDivr.getValue(0);
nSignalMACDDivr = xSignalMACDDivr.getValue(0);
if (nMACDDivr == null) return;
setBarFgColor(xColor.getValue(0), 2);
return new Array(nMACDDivr, nSignalMACDDivr, nImpulseCD);
}
var bSecondInit = false;
var xMACDDivBuff = null;
var xMA_MACDDivBuff = null;
function Calc_ImpulseCD(SlowMA, FastMA, SignalMA) {
var nRes = 0;
var cColor = Color.green;
var nMACDDivBuff = 0;
var nMA_MACDDivBuff = 0;
var nMACDDivBuff1 = 0;
var nMA_MACDDivBuff1 = 0;
if (!bSecondInit) {
xMACDDivBuff = macd(FastMA, SlowMA, 1);
xMA_MACDDivBuff = sma(SignalMA, xMACDDivBuff);
bSecondINit = true;
}
nMACDDivBuff = xMACDDivBuff.getValue(0);
nMA_MACDDivBuff = xMA_MACDDivBuff.getValue(0);
nMACDDivBuff1 = xMACDDivBuff.getValue(-1);
nMA_MACDDivBuff1 = xMA_MACDDivBuff.getValue(-1);
if (nMA_MACDDivBuff1 == null) return;
nRes = nMACDDivBuff - nMA_MACDDivBuff;
if ((nMACDDivBuff - nMA_MACDDivBuff) > (nMACDDivBuff1 - nMA_MACDDivBuff1)) cColor = Color.green;
if ((nMACDDivBuff - nMA_MACDDivBuff) < (nMACDDivBuff1 - nMA_MACDDivBuff1)) cColor = Color.red;
return new Array(nRes, nMACDDivBuff, nMA_MACDDivBuff, cColor);
Regards,
Steven
Comment