I need a single line golden macd

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

I need a single line golden macd

Postby chenzhuo82 » Fri Feb 12, 2010 6:05 am

I have this indicator in mt4
chenzhuo82
 
Posts: 2
Joined: Fri Feb 12, 2010 5:51 am

Re: I need a single line golden macd

Postby chenzhuo82 » Fri Feb 12, 2010 2:38 pm

Code: Select all
#property copyright "GOLDEN "
#property link      "zx815@126.com "

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 DarkGray
#property indicator_color2 Blue
#property indicator_color3 Red
#property indicator_color4 Lime

extern int FastEMA = 12;
extern int SlowEMA = 26;
extern int SignalSMA = 9;
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];
int gi_unused_108 = 0;

int init() {
   IndicatorBuffers(5);
   SetIndexStyle(0, DRAW_HISTOGRAM);
   SetIndexStyle(1, DRAW_HISTOGRAM);
   SetIndexStyle(2, DRAW_HISTOGRAM);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexStyle(4, DRAW_NONE);
   IndicatorDigits(Digits + 1);
   SetIndexBuffer(0, g_ibuf_88);
   SetIndexBuffer(1, g_ibuf_92);
   SetIndexBuffer(2, g_ibuf_96);
   SetIndexBuffer(3, g_ibuf_100);
   SetIndexBuffer(4, g_ibuf_104);
   IndicatorShortName("Golden MACD(" + FastEMA + "," + SlowEMA + "," + SignalSMA + ")");
   SetIndexLabel(0, "MACD");
   SetIndexLabel(1, "MACD");
   SetIndexLabel(2, "MACD");
   SetIndexLabel(3, "Signal");
   return (0);
}

int start() {
   int li_4 = IndicatorCounted();
   if (li_4 > 0) li_4--;
   int li_0 = Bars - li_4;
   for (int li_8 = 0; li_8 < li_0; li_8++) g_ibuf_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);
   for (li_8 = 0; li_8 < li_0; li_8++) g_ibuf_100[li_8] = iMAOnArray(g_ibuf_104, Bars, SignalSMA, 0, MODE_SMA, li_8);
   for (li_8 = 0; li_8 < li_0; li_8++) {
      if (g_ibuf_104[li_8] > 0.0 && g_ibuf_104[li_8] >= g_ibuf_100[li_8]) {
         g_ibuf_92[li_8] = g_ibuf_104[li_8];
         g_ibuf_96[li_8] = 0;
         g_ibuf_88[li_8] = 0;
      }
      if (g_ibuf_104[li_8] < 0.0 && g_ibuf_104[li_8] <= g_ibuf_100[li_8]) {
         g_ibuf_96[li_8] = g_ibuf_104[li_8];
         g_ibuf_92[li_8] = 0;
         g_ibuf_88[li_8] = 0;
      }
      if ((g_ibuf_104[li_8] > 0.0 && g_ibuf_104[li_8] < g_ibuf_100[li_8]) || (g_ibuf_104[li_8] < 0.0 && g_ibuf_104[li_8] > g_ibuf_100[li_8])) {
         g_ibuf_88[li_8] = g_ibuf_104[li_8];
         g_ibuf_92[li_8] = 0;
         g_ibuf_96[li_8] = 0;
      }
   }
   return (0);
}
chenzhuo82
 
Posts: 2
Joined: Fri Feb 12, 2010 5:51 am

Re: I need a single line golden macd

Postby Nikolay.Gekht » Fri Feb 12, 2010 3:50 pm

I have heavy moderated the post. :-) Guys, such discussions are a little bit out of the forum problem area. We do not need any claims, isn't it? So, please use PM for such discussions.
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: I need a single line golden macd

Postby Nikolay.Gekht » Tue Feb 16, 2010 6:18 pm

Sorry for delay. Please find the indicator you have requested here: viewtopic.php?f=17&t=358

I have checked it against MT4 implementation.
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: No registered users and 17 guests