Mq4 to afl

#1
IF ANYBODY KNOW HOW TO CONVERT FROM MQ4 TO AFL

I PROVIDE THE CODINGS AS FOLLOWS

/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : [email protected]
*/

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 White
#property indicator_color2 Blue
#property indicator_color3 Red

extern int period = 5;
int g_ma_method_80 = MODE_LWMA;
int g_applied_price_84 = PRICE_CLOSE;
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double gda_100[];

int init() {
IndicatorBuffers(3);
SetIndexBuffer(1, g_ibuf_88);
SetIndexBuffer(2, g_ibuf_92);
SetIndexBuffer(0, g_ibuf_96);
ArraySetAsSeries(g_ibuf_96, TRUE);
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_DASHDOT, 4);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_DASHDOT, 4);
SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_DASHDOT, 4);
IndicatorShortName("Trend Lord");
return (0);
}

int deinit() {
return (0);
}

double WMA(int ai_0, int a_period_4) {
return (iMA(NULL, 0, a_period_4, 0, g_ma_method_80, g_applied_price_84, ai_0));
}

int start() {
double lda_16[];
double lda_20[];
int l_ind_counted_0 = IndicatorCounted();
if (l_ind_counted_0 < 0) return (-1);
int li_4 = 0;
int l_period_8 = MathSqrt(period);
int li_12 = Bars - l_ind_counted_0 + period + 1;
if (li_12 > Bars) li_12 = Bars;
ArrayResize(lda_16, li_12);
ArraySetAsSeries(lda_16, TRUE);
ArrayResize(lda_20, li_12);
ArraySetAsSeries(lda_20, TRUE);
for (li_4 = 0; li_4 < li_12; li_4++) lda_16[li_4] = 2.0 * WMA(li_4, period / 1) - WMA(li_4, period);
for (li_4 = 0; li_4 < li_12 - period; li_4++) g_ibuf_96[li_4] = iMAOnArray(lda_16, 0, l_period_8, 0, g_ma_method_80, li_4);
for (li_4 = li_12 - period; li_4 >= 0; li_4--) {
lda_20[li_4] = lda_20[li_4 + 1];
if (g_ibuf_96[li_4] > g_ibuf_96[li_4 + 1]) lda_20[li_4] = 1;
if (g_ibuf_96[li_4] < g_ibuf_96[li_4 + 1]) lda_20[li_4] = -1;
if (lda_20[li_4] > 0.0) {
g_ibuf_88[li_4] = g_ibuf_96[li_4];
if (lda_20[li_4 + 1] < 0.0) g_ibuf_88[li_4 + 1] = g_ibuf_96[li_4 + 1];
g_ibuf_92[li_4] = EMPTY_VALUE;
} else {
if (lda_20[li_4] < 0.0) {
g_ibuf_92[li_4] = g_ibuf_96[li_4];
if (lda_20[li_4 + 1] > 0.0) g_ibuf_92[li_4 + 1] = g_ibuf_96[li_4 + 1];
g_ibuf_88[li_4] = EMPTY_VALUE;
}
}
gda_100[li_4] = lda_20[li_4];
}
return (0);
}
 

Similar threads