Req: convert Zonetrade MT4 to AFL

#1
dear pros,
anyone can help me to convert Zonetrade MT4 to AFL please.

Zonetrade MT4:





//+------------------------------------------------------------------+
//| ZoneTrade_v2.4.mq4 |
//| Duke3D |
//| [email protected] |
//+------------------------------------------------------------------+
#property copyright "Duke3D"
#property link "[email protected]"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Gray
#property indicator_color4 Gray
#property indicator_color5 Green
#property indicator_color6 Red
#property indicator_color7 Gray
#property indicator_color8 Gray

#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 3
#property indicator_width4 3
#property indicator_width5 1
#property indicator_width6 1
#property indicator_width7 1
#property indicator_width8 1

extern color GreenZone = Green; // ???? ???????? ????
extern color RedZone = Red; // ???? ??????? ????
extern color GreyZone = Gray; // ???? ????? ????
double AC_0;
double AC_1;
double AO_0;
double AO_1;
string name;
extern int BodyWidth = 3; // ?????? ???? ?????
extern int ShadowWidth = 1; // ?????? ???? ?????
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];
//----

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM, 0, BodyWidth, GreenZone);
SetIndexBuffer(0, ExtMapBuffer1);

SetIndexStyle(1,DRAW_HISTOGRAM, 0, BodyWidth, RedZone);
SetIndexBuffer(1, ExtMapBuffer2);

SetIndexStyle(2,DRAW_HISTOGRAM, 0, BodyWidth, GreyZone);
SetIndexBuffer(2, ExtMapBuffer3);

SetIndexStyle(3,DRAW_HISTOGRAM, 0, BodyWidth, GreyZone);
SetIndexBuffer(3, ExtMapBuffer4);

SetIndexStyle(4,DRAW_HISTOGRAM, 0, ShadowWidth, GreenZone);
SetIndexBuffer(4, ExtMapBuffer5);

SetIndexStyle(5,DRAW_HISTOGRAM, 0, ShadowWidth, RedZone);
SetIndexBuffer(5, ExtMapBuffer6);

SetIndexStyle(6,DRAW_HISTOGRAM, 0, ShadowWidth, GreyZone);
SetIndexBuffer(6, ExtMapBuffer7);

SetIndexStyle(7,DRAW_HISTOGRAM, 0, ShadowWidth, GreyZone);
SetIndexBuffer(7, ExtMapBuffer8);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int i, limit;
double ZTOpen, ZTHigh, ZTLow, ZTClose;

if(counted_bars > 0) counted_bars--;
i = Bars - counted_bars - 1;

while(i>=0)
{
ZTOpen = Open;
ZTHigh = High;
ZTLow = Low;
ZTClose = Close;
//===================================================================================================================
if(IndAC(i)==1 && IndAO(i)==1) // ??????? ????
{
if(Open>Close) // bear
{
ExtMapBuffer1 = ZTOpen;
ExtMapBuffer2 = ZTClose;
}
if(Open<Close) // bull
{
ExtMapBuffer1 = ZTClose;
ExtMapBuffer2 = ZTOpen;
}
ExtMapBuffer5 = ZTHigh;
ExtMapBuffer6 = ZTLow;
}
//===================================================================================================================
if(IndAC(i)==2 && IndAO(i)==2) // ??????? ????
{
if(Open>Close) // bear
{
ExtMapBuffer1 = ZTClose;
ExtMapBuffer2 = ZTOpen;
}
if(Open<Close) // bull
{
ExtMapBuffer1 = ZTOpen;
ExtMapBuffer2 = ZTClose;
}
ExtMapBuffer5 = ZTLow;
ExtMapBuffer6 = ZTHigh;
}
//===================================================================================================================
if(IndAC(i)==1 && IndAO(i)==2) // ????? ????
{
if(Open>Close) // bear
{
ExtMapBuffer3 = ZTOpen;
ExtMapBuffer4 = ZTClose;
}
if(Open<Close) // bull
{
ExtMapBuffer3 = ZTClose;
ExtMapBuffer4 = ZTOpen;
}
ExtMapBuffer7 = ZTHigh;
ExtMapBuffer8 = ZTLow;
}
//===================================================================================================================
if(IndAC(i)==2 && IndAO(i)==1) // ????? ????
{
if(Open>Close) // bear
{
ExtMapBuffer3 = ZTClose;
ExtMapBuffer4 = ZTOpen;
}
if(Open<Close) // bull
{
ExtMapBuffer3 = ZTOpen;
ExtMapBuffer4 = ZTClose;
}
ExtMapBuffer7 = ZTLow;
ExtMapBuffer8 = ZTHigh;
}
i--;
}
//===================================================================================================================
return(0);
}
//===================================================================================================================
int IndAC(int Shift)
{
int DirectionAC;
AC_0 = iAC(Symbol(),0,Shift);
AC_1 = iAC(Symbol(),0,Shift+1);
if(AC_0>AC_1) {DirectionAC = 1;} // ??????? ???
if(AC_0<AC_1) {DirectionAC = 2;} // ??????? ???
return(DirectionAC);
}
//===================================================================================================================
int IndAO(int Shift)
{
int DirectionAO;
AO_0 = iAO(Symbol(),0,Shift);
AO_1 = iAO(Symbol(),0,Shift+1);
if(AO_0>AO_1) {DirectionAO = 1;} // ??????? ???
if(AO_0<AO_1) {DirectionAO = 2;} // ??????? ???
return(DirectionAO);
}
//===================================================================================================================
 

Similar threads