Jump to content

(Req) MACD indicator color change


Recommended Posts

If any one could provide a MACD MQ4 indicator (12, 26, 9) that changes color, I'd appreciate it. When the histogram is going up, color blue. Then when a bar closes and the MACD is less that the previous bar, the MACD turns pink and stays pink as long as the MACD is going down. Once the MACD indicator is greater than the previous bar, change to Blue, etc. Not concerned with the signal line or MACD crossing zero.

 

 

MQ4 indicator that I can download appreciated. ^:)^

 

Thanks,

 

Jim

Link to comment
Share on other sites

Re: (Req) MACD indicator color change

 

If any one could provide a MACD MQ4 indicator (12, 26, 9) that changes color, I'd appreciate it. When the histogram is going up, color blue. Then when a bar closes and the MACD is less that the previous bar, the MACD turns pink and stays pink as long as the MACD is going down. Once the MACD indicator is greater than the previous bar, change to Blue, etc. Not concerned with the signal line or MACD crossing zero.

 

 

MQ4 indicator that I can download appreciated. ^:)^

 

Thanks,

 

Jim

 

Is this it

 

 

 

 

/*

Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []

Website: http://purebeam.biz

E-mail : [email protected]

*/

#property copyright "Copyright © 2007, Herb Spirit, Inc."

#property link "http://www.herbspirit.com/mql"

 

#property indicator_separate_window

#property indicator_levelcolor Gray

#property indicator_buffers 4

#property indicator_color1 Lime

#property indicator_color2 Red

#property indicator_color3 Yellow

#property indicator_color4 Silver

#property indicator_level1 45.0

#property indicator_level2 30.0

#property indicator_level3 15.0

#property indicator_style4 2

#property indicator_level4 -15.0

#property indicator_level5 -30.0

#property indicator_level6 -45.0

 

extern int FastEMA = 5;

extern int SlowEMA = 13;

extern int SignalSMA = 1;

extern double MinDiff = 0.0;

extern int FontSize = 8;

extern color FontColor = Silver;

double gda_104[];

double g_ibuf_108[];

double g_ibuf_112[];

double g_ibuf_116[];

double g_ibuf_120[];

 

int init() {

SetIndexStyle(0, DRAW_HISTOGRAM);

SetIndexStyle(1, DRAW_HISTOGRAM);

SetIndexStyle(2, DRAW_HISTOGRAM);

SetIndexStyle(3, DRAW_LINE);

SetLevelValue(0, 45);

SetLevelValue(1, 30);

SetLevelValue(2, 15);

SetLevelValue(3, -15);

SetLevelValue(4, -30);

SetLevelValue(5, -45);

SetIndexDrawBegin(1, SignalSMA);

IndicatorDigits(1);

SetIndexBuffer(0, g_ibuf_108);

SetIndexBuffer(1, g_ibuf_112);

SetIndexBuffer(2, g_ibuf_116);

SetIndexBuffer(3, g_ibuf_120);

IndicatorShortName(WindowExpertName() + " (" + FastEMA + "," + SlowEMA + "," + SignalSMA + ")");

SetIndexLabel(0, "MACD UP");

SetIndexLabel(1, "MACD DN");

SetIndexLabel(2, "MACD EQ");

SetIndexLabel(3, "Signal");

return (0);

}

 

int deinit() {

string l_name_0 = WindowExpertName() + "," + Symbol() + "," + Period();

ObjectDelete(l_name_0);

return (0);

}

 

int start() {

double lda_20[];

int li_32;

int l_ind_counted_4 = IndicatorCounted();

int li_0 = MathMin(Bars - SlowEMA, Bars - l_ind_counted_4 + 1);

ArrayResize(gda_104, li_0);

ArraySetAsSeries(gda_104, TRUE);

for (int li_8 = 0; li_8 < li_0; li_8++) gda_104[li_8] = (iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, li_8) - iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, li_8)) / Point;

for (li_8 = li_0 - 2; li_8 >= 0; li_8--) {

if (MathAbs(gda_104[li_8] - (gda_104[li_8 + 1])) < MinDiff) {

g_ibuf_116[li_8] = gda_104[li_8];

g_ibuf_108[li_8] = 0;

g_ibuf_112[li_8] = 0;

} else {

if (gda_104[li_8] > gda_104[li_8 + 1]) {

g_ibuf_108[li_8] = gda_104[li_8];

g_ibuf_112[li_8] = 0;

g_ibuf_116[li_8] = 0;

} else {

g_ibuf_112[li_8] = gda_104[li_8];

g_ibuf_108[li_8] = 0;

g_ibuf_116[li_8] = 0;

}

}

}

for (li_8 = 0; li_8 < li_0; li_8++) g_ibuf_120[li_8] = iMAOnArray(gda_104, Bars, SignalSMA, 0, MODE_SMA, li_8);

double ld_12 = (iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, 1) - iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, 1)) / Point;

ArrayResize(lda_20, Bars);

ArraySetAsSeries(lda_20, TRUE);

ArrayCopy(lda_20, Close, 0, 0, ArraySize(lda_20));

double ld_24 = (iMAOnArray(lda_20, 0, FastEMA, 0, MODE_EMA, 0) - iMAOnArray(lda_20, 0, SlowEMA, 0, MODE_EMA, 0)) / Point;

if (ld_24 < ld_12) {

while (ld_24 < ld_12) {

li_32++;

lda_20[0] += Point;

ld_24 = (iMAOnArray(lda_20, 0, FastEMA, 0, MODE_EMA, 0) - iMAOnArray(lda_20, 0, SlowEMA, 0, MODE_EMA, 0)) / Point;

}

} else {

while (ld_24 > ld_12) {

li_32--;

lda_20[0] = lda_20[0] - Point;

ld_24 = (iMAOnArray(lda_20, 0, FastEMA, 0, MODE_EMA, 0) - iMAOnArray(lda_20, 0, SlowEMA, 0, MODE_EMA, 0)) / Point;

}

}

string l_name_36 = WindowExpertName() + "," + Symbol() + "," + Period();

if (ObjectFind(l_name_36) < 0) ObjectCreate(l_name_36, OBJ_TEXT, WindowFind(WindowExpertName() + " (" + FastEMA + "," + SlowEMA + "," + SignalSMA + ")"), Time[0] + 60 * Period(), gda_104[0] / 2.0);

else ObjectMove(l_name_36, 0, Time[0] + 60 * Period(), gda_104[0] / 2.0);

if (li_32 != 0) ObjectSetText(l_name_36, DoubleToStr(li_32, 0), FontSize, "Courier", FontColor);

else ObjectSetText(l_name_36, " ", FontSize, "Courier", FontColor);

return (0);

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...