Convert metatrader to afl

#1
can anybody please convert me metatrader to AFL !!!!!!





#property copyright "Copyright 2007, Soni fx"
#property link "http://sonyirwana.blogspot.com"

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 1.0
#property indicator_buffers 4
#property indicator_color1 RoyalBlue
#property indicator_color2 Red
#property indicator_color3 RoyalBlue
#property indicator_color4 Red

extern int TimeFrame = 0;
int g_period_80 = 14;
int g_period_84 = 5;
int g_slowing_88 = 3;
extern int MAMethod = 0;
extern int PriceField = 0;
double gd_100 = 76.4;
double gd_108 = 23.6;
bool gi_116 = FALSE;
extern int MaxBarsToCount = 1500;
string gs_unused_124 = "SMA0 EMA1 SMMA2 LWMA3";
string gs_unused_132 = "0=Hi/Low 1=Close/Close";
extern string _TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
double g_ibuf_148[];
double g_ibuf_152[];
double g_ibuf_156[];
double g_ibuf_160[];

int init() {
string ls_unused_12;
string ls_0 = "FXSONI TREND ANALYZER v1.c";
IndicatorShortName(ls_0);
SetIndexStyle(0, DRAW_HISTOGRAM);
SetIndexStyle(1, DRAW_HISTOGRAM);
SetIndexStyle(2, DRAW_HISTOGRAM);
SetIndexStyle(3, DRAW_HISTOGRAM);
SetIndexBuffer(0, g_ibuf_148);
SetIndexBuffer(1, g_ibuf_152);
SetIndexBuffer(2, g_ibuf_156);
SetIndexBuffer(3, g_ibuf_160);
if (TimeFrame < Period()) TimeFrame = Period();
switch (TimeFrame) {
case 1:
ls_unused_12 = "Period_M1";
break;
case 5:
ls_unused_12 = "Period_M5";
break;
case 15:
ls_unused_12 = "Period_M15";
break;
case 30:
ls_unused_12 = "Period_M30";
break;
case 60:
ls_unused_12 = "Period_H1";
break;
case 240:
ls_unused_12 = "Period_H4";
break;
case 1440:
ls_unused_12 = "Period_D1";
break;
case 10080:
ls_unused_12 = "Period_W1";
break;
case 43200:
ls_unused_12 = "Period_MN1";
break;
default:
ls_unused_12 = "Current Timeframe";
}
ls_0 = "FXSONI TREND ANALYZER v1.c";
IndicatorShortName(ls_0);
SetIndexLabel(0, "Overbought or Strong Bulls");
SetIndexLabel(1, "Oversold or Strong Bears");
SetIndexLabel(2, "Potential to Bulls");
SetIndexLabel(3, "Potential to Bears");
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
return (0);
}

int start() {
int li_0;
double l_istochastic_4;
double l_istochastic_12;
int lia_20[];
int li_40;
int li_44;
int lia_48[];
int l_shift_32 = 0;
int l_ind_counted_36 = IndicatorCounted();
ArrayCopySeries(lia_20, 5, Symbol(), TimeFrame);
int li_28 = Bars - l_ind_counted_36;
li_28 = MathMax(li_28, TimeFrame / Period());
li_28 = MathMin(li_28, MaxBarsToCount);
int l_index_24 = 0;
l_shift_32 = 0;
while (l_index_24 < li_28) {
if (Time[l_index_24] < lia_20[l_shift_32]) l_shift_32++;
l_istochastic_4 = iStochastic(NULL, TimeFrame, g_period_80, g_period_84, g_slowing_88, MAMethod, PriceField, MODE_MAIN, l_shift_32);
l_istochastic_12 = iStochastic(NULL, TimeFrame, g_period_80, g_period_84, g_slowing_88, MAMethod, PriceField, MODE_SIGNAL, l_shift_32);
if (gi_116) {
if (l_istochastic_4 >= gd_100) li_0 = 1;
if (l_istochastic_4 <= gd_108) li_0 = 2;
if (l_istochastic_4 < gd_100 && l_istochastic_4 > l_istochastic_12 && l_istochastic_4 > gd_108) li_0 = 3;
if (l_istochastic_4 < gd_100 && l_istochastic_4 < l_istochastic_12 && l_istochastic_4 > gd_108) li_0 = 4;
} else
if (l_istochastic_12 >= gd_100) li_0 = 1;
if (l_istochastic_12 <= gd_108) li_0 = 2;
if (l_istochastic_12 < gd_100 && l_istochastic_4 > l_istochastic_12 && l_istochastic_12 > gd_108) li_0 = 3;
if (l_istochastic_12 < gd_100 && l_istochastic_4 < l_istochastic_12 && l_istochastic_12 > gd_108) li_0 = 4;
if (li_0 == 1) {
g_ibuf_148[l_index_24] = 1;
g_ibuf_152[l_index_24] = 0;
g_ibuf_156[l_index_24] = 0;
g_ibuf_160[l_index_24] = 0;
}
if (li_0 == 2) {
g_ibuf_148[l_index_24] = 0;
g_ibuf_152[l_index_24] = 1;
g_ibuf_156[l_index_24] = 0;
g_ibuf_160[l_index_24] = 0;
}
if (li_0 == 3) {
g_ibuf_148[l_index_24] = 0;
g_ibuf_152[l_index_24] = 0;
g_ibuf_156[l_index_24] = 1;
g_ibuf_160[l_index_24] = 0;
}
if (li_0 == 4) {
g_ibuf_148[l_index_24] = 0;
g_ibuf_152[l_index_24] = 0;
g_ibuf_156[l_index_24] = 0;
g_ibuf_160[l_index_24] = 1;
}
l_index_24++;
}
if (li_40 > Period()) {
li_44 = li_40 / Period() + 1;
ArrayResize(lia_48, li_44);
ArrayCopySeries(lia_48, 5, Symbol(), Period());
for (l_index_24 = 0; l_index_24 < li_44 + 1; l_index_24++) {
if (lia_48[l_index_24] >= lia_20[0]) {
g_ibuf_148[l_index_24] = g_ibuf_148[0];
g_ibuf_152[l_index_24] = g_ibuf_152[0];
g_ibuf_156[l_index_24] = g_ibuf_156[0];
g_ibuf_160[l_index_24] = g_ibuf_160[0];
}
}
}
return (0);
}
 
Last edited:

Similar threads