The MT4 script are as follows:
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 SteelBlue
#property indicator_color2 Red
#property indicator_color3 Yellow
int cci50 = 50; //initiate the CCI lookup period as 50
int ma144 = 144; //initiate the MA lookup period as 144
int ma233 = 233; //initiate the MA lookup period as 233
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double gd_124;
double gd_132;
double g_icci_140;
int init() {
IndicatorBuffers(3);
SetIndexBuffer(0, g_ibuf_88);
SetIndexStyle(0, DRAW_HISTOGRAM);
SetIndexBuffer(1, g_ibuf_92);
SetIndexStyle(1, DRAW_HISTOGRAM);
SetIndexBuffer(2, g_ibuf_96);
SetIndexStyle(2, DRAW_HISTOGRAM);
return (0);
}
int deinit() {
return (0);
}
int start() {
int l_ind_counted_4 = IndicatorCounted();
if (l_ind_counted_4 < 0) return (-1);
int li_8 = Bars - l_ind_counted_4;
if (li_8 > Bars) li_8 = Bars;
for (int li_0 = li_8; li_0 >= 0; li_0--) {
g_icci_140 = iCCI(NULL, 0, cci50, PRICE_TYPICAL, li_0);
gd_124 = iMA(NULL, 0, ma144, 0, MODE_EMA, PRICE_CLOSE, li_0) - iMA(NULL, 0, ma233, 0, MODE_EMA, PRICE_CLOSE, li_0);
gd_132 = iMA(NULL, 0, ma144, 0, MODE_EMA, PRICE_CLOSE, li_0 + 1) - iMA(NULL, 0, ma233, 0, MODE_EMA, PRICE_CLOSE, li_0 + 1);
g_ibuf_88[li_0] = 0.0;
g_ibuf_92[li_0] = 0.0;
g_ibuf_96[li_0] = 0.0;
if (g_icci_140 > 0.0 && gd_124 > gd_132) g_ibuf_88[li_0] = 1.0;
else {
if (g_icci_140 < 0.0 && gd_124 < gd_132) g_ibuf_92[li_0] = 1.0;
else g_ibuf_96[li_0] = 1.0;
}
}
return (0);
}
Comment