indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > MetaTrader

DPonline
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 18-10-2012, 12:35 PM
mokashism's Avatar
mokashism mokashism is offline
Newbie
 
Join Date: Aug 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
mokashism is on a distinguished road
Thumbs up i want one mt4 (supertrend) convert in to afl

here is the code which i want in afl format, please upload t if one have it....


#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 2

//+------------------------------------------------------------------+
//| Universal Constants |
//+------------------------------------------------------------------+
#define PHASE_NONE 0
#define PHASE_BUY 1
#define PHASE_SELL -1

//+------------------------------------------------------------------+
//| User input variables |
//+------------------------------------------------------------------+
extern string AdvisorName = "Kolier_SuperTrend_Indi";
extern string AdvisorVersion = "1.0.1"; // The version number of this script
extern string ProjectPage = "http://kolier.li/project/kolier-supertrend-indi"; // The project landing page
extern int BarsToCount = 0; // Set to 0 to count all bars, if >0, set more to calculate more bars
extern int TrendMode = 0; // 0=Show line same as SuperTrend.mq4, 1=New way to show trend line
// iATR
extern string ATR_Indicator = "http://kolier.li/example/mt4-iatr-system-average-true-range";
extern int ATR_Period = 10;
extern double ATR_Multiplier = 3.0;

//+------------------------------------------------------------------+
//| Universal variables |
//+------------------------------------------------------------------+
double buffer_line_up[], buffer_line_down[];
double atr, band_upper, band_lower;
int phase=PHASE_NONE;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorShortName(AdvisorName);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));

SetIndexBuffer(0, buffer_line_up);
SetIndexLabel(0, "Up Trend");
SetIndexBuffer(1, buffer_line_down);
SetIndexLabel(1, "Down Trend");

return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int bars_counted = IndicatorCounted();
if(bars_counted < 0) {
return(1);
}
else if(bars_counted > 0) {
bars_counted--;
}
int limit = Bars - bars_counted;
if(BarsToCount>0 && limit>BarsToCount) {
limit = BarsToCount;
}

for(int i=limit; i>=0; i--) {
atr = iATR(Symbol(), 0, ATR_Period, i);
band_upper = (High[i]+Low[i])/2 + ATR_Multiplier * atr;
band_lower = (High[i]+Low[i])/2 - ATR_Multiplier * atr;

if(phase==PHASE_NONE) {
buffer_line_up[i] = (High[i+1]+Low[i+1])/2;
buffer_line_down[i] = (High[i+1]+Low[i+1])/2;
}

if(phase!=PHASE_BUY && Close[i]>buffer_line_down[i+1] && buffer_line_down[i+1]!=EMPTY_VALUE) {
phase = PHASE_BUY;
buffer_line_up[i] = band_lower;
buffer_line_up[i+1] = buffer_line_down[i+1];
}

if(phase!=PHASE_SELL && Close[i]<buffer_line_up[i+1] && buffer_line_up[i+1]!=EMPTY_VALUE) {
phase = PHASE_SELL;
buffer_line_down[i] = band_upper;
buffer_line_down[i+1] = buffer_line_up[i+1];
}

if(phase==PHASE_BUY
&& ((TrendMode==0 && buffer_line_up[i+2]!=EMPTY_VALUE) || TrendMode==1) ) {
if(band_lower>buffer_line_up[i+1]) {
buffer_line_up[i] = band_lower;
}
else {
buffer_line_up[i] = buffer_line_up[i+1];
}
}
if(phase==PHASE_SELL
&& ((TrendMode==0 && buffer_line_down[i+2]!=EMPTY_VALUE) || TrendMode==1) ) {
if(band_upper<buffer_line_down[i+1]) {
buffer_line_down[i] = band_upper;
}
else {
buffer_line_down[i] = buffer_line_down[i+1];
}
}

}

return(0);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #22 (permalink)  
Old 18-10-2012, 04:56 PM
cas67's Avatar
cas67 cas67 is offline
Regulars
 
Join Date: Mar 2009
Posts: 115
Thanks: 126
Thanked 369 Times in 80 Posts
cas67 is a jewel in the roughcas67 is a jewel in the roughcas67 is a jewel in the roughcas67 is a jewel in the roughcas67 is a jewel in the roughcas67 is a jewel in the rough
Default

Hello ,
i think this is what you are looking for ..
its translated by Edward Pottasch,

the supertrend code is translated as:

/*
original code:
Factor:=Input("Factor",1.00,10.00,3.00);
Pd:=Input("ATR Periods",1,100,10);
Up:=MP()+(Factor*ATR(Pd));
Dn:=MP()-(Factor*ATR(Pd));
Td:=If(Cross(C,LLV(Up,13)),1,If(Cross(HHV(Dn,13),C ),-1,PREV));
Dnx:=If(Dn=HighestSince(1,Cross(Td,0),Dn),Dn,PREV) ;
Upx:=If(Up=LowestSince(1,Cross(0,Td),Up),Up,PREV);
ST:=If(Td=1,Dnx,If(Td=-1,Upx,PREV));
ST

translation in Amibroker AFL, Edward Pottasch, 9/29/2011
*/



// translation in Amibroker AFL, Edward Pottasch, 9/29/2011
Factor=Param("Factor",3,1,10,1);
Pd=Param("ATR Periods",10,1,100,1);
Up=(H+L+C)/3+(Factor*ATR(Pd));
Dn=(H+L+C)/3-(Factor*ATR(Pd));

aa=Cross(C,LLV(Up,13));
bb=Cross(HHV(Dn,13),C);
Td[0]=1;
for(i=1;i<BarCount;i++ )
{
prev=Td[i-1];
if(aa[i])
{
Td[i]=1;
}
else if(bb[i])
{
Td[i]=-1;
}
else
{
Td[i]=prev;
}
}
aa=Dn==HighestSince(Cross(Td,0),Dn);
Dnx=Dn[0];
for(i=1;i<BarCount;i++ )
{
prev=Dnx[i-1];
if(aa[i])
{
Dnx[i]=Dn[i];
}
else
{
Dnx[i]=prev;
}
}
aa=Up==LowestSince(Cross(0,Td),Up);
Upx=Up[0];
for(i=1;i<BarCount;i++ )
{
prev=Upx[i-1];
if(aa[i])
{
Upx[i]=Up[i];
}
else
{
Upx[i]=prev;
}
}
aa=Td==1;
bb=Td==-1;
ST[0]=1;
trend=Null;
for(i=1;i<BarCount;i++ )
{
prev=ST[i-1];
if(aa[i])
{
ST[i]=Dnx[i];
trend[i]=1;
}
else if(bb[i])
{
ST[i]=Upx[i];
trend[i]=-1;
}
else
{
ST[i]=prev;
trend[i]=trend[i-1];
}
}
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
SetChartOptions(0,chartShowDates);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));
Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);
Plot(IIf(trend==1,ST,Null),"\nUP",colorGreen,style Dashed);
Plot(IIf(trend==-1,ST,Null),"\nDN",colorRed,styleDashed);
Plot(ST,"\nST",colorWhite,styleDashed);

Thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #23 (permalink)  
Old 23-11-2012, 04:44 PM
HarryJobs HarryJobs is offline
Newbie
 
Join Date: Jul 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
HarryJobs is on a distinguished road
Default Please help to convert afl file to mq4

Hello All,

Can anybody please help to convert attached .afl file into .mq4?

I really appreciate your help in this concern.

Regards,
Hardik
Attached Files
File Type: afl heikin ashi with KPL.afl (1.2 KB, 50 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #24 (permalink)  
Old 06-12-2012, 11:33 PM
HarryJobs HarryJobs is offline
Newbie
 
Join Date: Jul 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
HarryJobs is on a distinguished road
Default Help me please.

Can anybody please convert this afl into mt4?


//---- heikin ashi
HaClose = (O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), .40);
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
xDiff = (HaHigh - Halow) * IIf(StrFind(Name(),"JPY"),100,10000);
barcolor = IIf(HaClose >= HaOpen,colorGreen,colorRed);
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleCandle );
// Plot(EMA(HaClose,9),"",colorWhite, styleLine);
// Plot(EMA(HaClose,18),"",colorBlack, styleLine);
_SECTION_BEGIN("KPL Swing");
//Copyright Kamalesh Langote. Email:kpl@vfmdirect.com. More details at KPL Swing (breakout trading system)
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 20, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Bu y,Low,High));
_SECTION_END();
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #25 (permalink)  
Old 03-07-2013, 07:42 PM
leenazen leenazen is offline
Newbie
 
Join Date: Jun 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
leenazen is on a distinguished road
chatty Help mq4 to afl or converter software link scalper Ind

Code:
/*
   Generated by EX4-TO-MQ4 decompiler LITE V4.0.409.1e [-]
   Website: https://purebeam.biz
   E-mail : purebeam@gmail.com
*/

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Blue
#property indicator_color3 Aqua

extern int SignalPeriod = 10;
int gi_80 = 0;
extern int NR_SLIPE = 3;
int gi_88 = PRICE_CLOSE;
extern double FilterNumber = 1.0;
bool gi_100 = TRUE;
int gi_104 = 0;
extern int lineWidth = 3;
extern int barsToDrawLine = 75;
extern bool skipSingleBarSignal = FALSE;
extern int aTake_Profit = 0;
extern int aStop_Loss = 0;
extern bool aAlerts = TRUE;
extern bool EmailOn = FALSE;
datetime gt_136;
string gs_148;
string gs_156 = "fx_NR_Scalping";
double gda_164[];
double gda_168[];
double gda_172[];
double gda_176[];
int gi_180;
string gs_184;
int gi_192 = 0;

string GetTimeFrameStr() {
   string ls_4;
   switch (Period()) {
   case PERIOD_M1:
      ls_4 = "M1";
      break;
   case PERIOD_M5:
      ls_4 = "M5";
      break;
   case PERIOD_M15:
      ls_4 = "M15";
      break;
   case PERIOD_M30:
      ls_4 = "M30";
      break;
   case PERIOD_H1:
      ls_4 = "H1";
      break;
   case PERIOD_H4:
      ls_4 = "H4";
      break;
   case PERIOD_D1:
      ls_4 = "D1";
      break;
   case PERIOD_W1:
      ls_4 = "W1";
      break;
   case PERIOD_MN1:
      ls_4 = "MN1";
      break;
   default:
      ls_4 = Period();
   }
   return (ls_4);
}

void DisplayAlert(string as_0, double ad_8, double ad_16, double ad_24) {
   string ls_32;
   string ls_40;
   string ls_48;
   string ls_56;
   if (Time[0] != gt_136) {
      gt_136 = Time[0];
      if (gs_148 != as_0) {
         gs_148 = as_0;
         if (ad_8 != 0.0) ls_48 = " @ Price " + DoubleToStr(ad_8, 4);
         else ls_48 = "";
         if (ad_16 != 0.0) ls_40 = ", TakeProfit   " + DoubleToStr(ad_16, 4);
         else ls_40 = "";
         if (ad_24 != 0.0) ls_32 = ", StopLoss   " + DoubleToStr(ad_24, 4);
         else ls_32 = "";
         ls_56 = gs_184 + "Scalping " + aRperiodf() + " Alert " + as_0 
            + "\n" 
            + as_0 + ls_48 + ls_40 + ls_32 
         + "\nDate & Time = " + TimeToStr(TimeCurrent(), TIME_DATE) + " " + TimeHour(TimeCurrent()) + ":" + TimeMinute(TimeCurrent()) + " ";
         Alert(ls_56, Symbol(), ", ", Period(), " minutes chart");
         PlaySound("alert.wav");
         if (EmailOn) SendMail(gs_184, ls_56);
      }
   }
}

int init() {
   IndicatorBuffers(4);
   if ((!SetIndexBuffer(0, gda_164)) && !SetIndexBuffer(1, gda_168) && (!SetIndexBuffer(2, gda_172)) && (!SetIndexBuffer(3, gda_176))) Print("cannot set indicator buffers!");
   if (gi_100) {
      SetIndexStyle(0, DRAW_ARROW, EMPTY, lineWidth - 3);
      SetIndexStyle(1, DRAW_ARROW, EMPTY, lineWidth - 3);
      SetIndexStyle(2, DRAW_ARROW, EMPTY, lineWidth - 3);
      SetIndexArrow(0, 159);
      SetIndexArrow(1, 159);
      SetIndexArrow(2, 159);
   } else {
      SetIndexStyle(0, DRAW_LINE);
      SetIndexStyle(1, DRAW_LINE);
      SetIndexStyle(2, DRAW_LINE);
   }
   gi_180 = SignalPeriod + MathFloor(MathSqrt(SignalPeriod));
   SetIndexDrawBegin(0, gi_180);
   SetIndexDrawBegin(1, gi_180);
   SetIndexDrawBegin(2, gi_180);
   IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS) + 1.0);
   IndicatorShortName("Scalping(" + SignalPeriod + ")");
   SetIndexLabel(0, "Scalping");
   gs_184 = Symbol() + " (" + GetTimeFrameStr() + "):  ";
   gs_148 = "";
   ArrayInitialize(gda_164, EMPTY_VALUE);
   ArrayInitialize(gda_172, EMPTY_VALUE);
   ArrayInitialize(gda_168, EMPTY_VALUE);
   return (0);
}

int deinit() {
   DelObj();
   return (0);
}

int start() {
   double ld_20;
   int li_28;
   int li_8 = IndicatorCounted();
   if (li_8 < 1) {
      for (int li_4 = 0; li_4 <= gi_180; li_4++) gda_176[Bars - li_4] = 0;
      for (li_4 = 0; li_4 <= SignalPeriod; li_4++) {
         gda_164[Bars - li_4] = EMPTY_VALUE;
         gda_168[Bars - li_4] = EMPTY_VALUE;
         gda_172[Bars - li_4] = EMPTY_VALUE;
      }
   }
   int li_0 = Bars - li_8;
   for (li_4 = 1; li_4 < li_0; li_4++) gda_176[li_4] = 2.0 * iMA(NULL, 0, MathFloor(SignalPeriod / FilterNumber), gi_80, NR_SLIPE, gi_88, li_4) - iMA(NULL, 0, SignalPeriod, gi_80, NR_SLIPE, gi_88, li_4);
   double ld_12 = iMAOnArray(gda_176, 0, MathFloor(MathSqrt(SignalPeriod)), 0, NR_SLIPE, 1);
   for (li_4 = 2; li_4 < li_0 + 1; li_4++) {
      ld_20 = iMAOnArray(gda_176, 0, MathFloor(MathSqrt(SignalPeriod)), 0, NR_SLIPE, li_4);
      li_28 = 0;
      if (ld_20 > ld_12) {
         gda_172[li_4 - 1] = ld_12 - gi_104 * Point;
         li_28 = 1;
      } else {
         if (ld_20 < ld_12) {
            gda_164[li_4 - 1] = ld_12 + gi_104 * Point;
            li_28 = 2;
         } else {
            gda_164[li_4 - 1] = EMPTY_VALUE;
            gda_168[li_4 - 1] = ld_12;
            gda_172[li_4 - 1] = EMPTY_VALUE;
            li_28 = 3;
         }
      }
      if (li_8 > 0) {
      }
      ld_12 = ld_20;
   }
   if (li_0 > barsToDrawLine) li_0 = barsToDrawLine;
   for (li_4 = 2; li_4 <= li_0; li_4++) {
      if (gda_164[li_4 - 1] != EMPTY_VALUE) {
         if (gda_164[li_4] != EMPTY_VALUE) drawLineSegment(li_4 - 1, li_4, 1);
         else drawLineSegment(li_4 - 1, li_4, 10);
      }
      if (gda_172[li_4 - 1] != EMPTY_VALUE) {
         if (gda_172[li_4] != EMPTY_VALUE) {
            drawLineSegment(li_4 - 1, li_4, -1);
            continue;
         }
         drawLineSegment(li_4 - 1, li_4, -10);
      }
   }
   if (aAlerts) {
      if ((skipSingleBarSignal == FALSE && gda_172[1] != EMPTY_VALUE && gda_172[2] == EMPTY_VALUE) || (skipSingleBarSignal == TRUE && gda_172[1] != EMPTY_VALUE && gda_172[2] != EMPTY_VALUE &&
         gda_172[3] == EMPTY_VALUE)) DisplayAlert("Sell signal", Close[1], aGetTPs(), aGetSLs());
      if ((skipSingleBarSignal == FALSE && gda_164[1] != EMPTY_VALUE && gda_164[2] == EMPTY_VALUE) || (skipSingleBarSignal == TRUE && gda_164[1] != EMPTY_VALUE && gda_164[2] != EMPTY_VALUE &&
         gda_164[3] == EMPTY_VALUE)) DisplayAlert("Buy signal", Close[1], aGetTPl(), aGetSLl());
   }
   return (0);
}

double aGetTPs() {
   return (Bid - aTake_Profit * Point);
}

double aGetTPl() {
   return (Ask + aTake_Profit * Point);
}

double aGetSLs() {
   return (Bid + aStop_Loss * Point);
}

double aGetSLl() {
   return (Ask - aStop_Loss * Point);
}

int aRperiodf() {
   return (10000.0 * (SignalPeriod * Point));
}

void DelObj() {
   string ls_0;
   int li_12;
   for (int li_8 = ObjectsTotal() - 1; li_8 >= 0; li_8--) {
      ls_0 = ObjectName(li_8);
      li_12 = StringLen(gs_156);
      if (StringSubstr(ls_0, 0, li_12) == gs_156) ObjectDelete(ls_0);
   }
}

void drawLineSegment(int ai_0, int ai_4, int ai_8) {
   double ld_20;
   double ld_28;
   color li_36;
   if (ai_8 > 0) {
      ld_20 = gda_164[ai_0];
      if (ai_8 == 1) ld_28 = gda_164[ai_4];
      else ld_28 = gda_172[ai_4];
      li_36 = Blue;
   } else {
      ld_20 = gda_172[ai_0];
      if (ai_8 == -1) ld_28 = gda_172[ai_4];
      else ld_28 = gda_164[ai_4];
      li_36 = Yellow;
   }
   int li_12 = Time[ai_0];
   int li_16 = Time[ai_4];
   if (ld_20 == EMPTY_VALUE || ld_28 == EMPTY_VALUE) {
      Print("Empty value for price line encountered!");
      return;
   }
   string ls_40 = gs_156 + "_segment_" + li_36 + li_12 + "_" + li_16;
   ObjectDelete(ls_40);
   ObjectCreate(ls_40, OBJ_TREND, 0, li_12, ld_20, li_16, ld_28, 0, 0);
   ObjectSet(ls_40, OBJPROP_WIDTH, lineWidth);
   ObjectSet(ls_40, OBJPROP_COLOR, li_36);
   ObjectSet(ls_40, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet(ls_40, OBJPROP_RAY, FALSE);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #26 (permalink)  
Old 03-09-2013, 01:43 PM
leenazen leenazen is offline
Newbie
 
Join Date: Jun 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
leenazen is on a distinguished road
Default

I NEED FOR MQ4 to AFL CONVERT

//+------------------------------------ ------------------------------+
//| ZIG ZAG NON REPAINT.mq4 |
//+------------------------------------ ------------------------------+
#property copyright "Copyrightę2010"
#property link ""

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
extern int Candle=100;
extern int Length=1;
double ExtMapBuffer1[];

int init()
{
SetIndexEmptyValue(0,0.0);
SetIndexStyle(0,DRAW_SECTION, 5,5);
SetIndexBuffer(0,ExtMapBuffer1);

return(0);
}
int deinit()
{
return(0);
}
int start()
{
int cnt,ticket,counted_bars=IndicatorCo unted();
int shift,Swing,Swing_n,uzl,i,zu,zd,mv;
double LL,HH,BH,BL,NH,NL;
double Uzel[10000][3];
string text;

if (High[1]> High[0]) {Comment("SELL !!");}

else if (High[1]< High[0]) {Comment("BUY !!");}
Swing_n=0;Swing=0;uzl=0;
BH =High[Candle];BL=Low[Candle];zu=Candle;zd=Candle;

for (shift=Candle;shift>=0;shift--) {
LL=10000000;HH=-100000000;
for (i=shift+Length;i>=shift+1;i--) {
if (Low< LL) {LL=Low;}
if (High>HH) {HH=High;}
}
if (Low[shift]<LL && High[shift]>HH){
Swing=2;
if (Swing_n==1) {zu=shift+1;}
if (Swing_n==-1) {zd=shift+1;}
} else {
if (Low[shift]<LL) {Swing=-1;}
if (High[shift]>HH) {Swing=1;}
}

if (Swing!=Swing_n && Swing_n!=0) {
if (Swing==2) {
Swing=-Swing_n;BH = High[shift];BL = Low[shift];
}
uzl=uzl+1;
if (Swing==1) {
Uzel[uzl][1]=zd;
Uzel[uzl][2]=BL;
}
if (Swing==-1) {
Uzel[uzl][1]=zu;
Uzel[uzl][2]=BH;
}
BH = High[shift];
BL = Low[shift];
}

if (Swing==1) {
if (High[shift]>=BH) {BH=High[shift];zu=shift;}}
if (Swing==-1) {
if (Low[shift]<=BL) {BL=Low[shift]; zd=shift;}}
Swing_n=Swing;
}
for (i=1;i<=uzl;i++) {
mv=StrToInteger(DoubleToStr(Uzel[1],0));
ExtMapBuffer1[mv]=Uzel[2];
}

return(0);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #27 (permalink)  
Old 05-10-2013, 06:23 AM
AmiSmart AmiSmart is offline
Regular
 
Join Date: Sep 2013
Posts: 53
Thanks: 2
Thanked 79 Times in 37 Posts
AmiSmart is on a distinguished roadAmiSmart is on a distinguished road
Default

Originally Posted by mokashism View Post
here is the code which i want in afl format, please upload t if one have it....


#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 2

//+------------------------------------------------------------------+
//| Universal Constants |
//+------------------------------------------------------------------+
#define PHASE_NONE 0
#define PHASE_BUY 1
#define PHASE_SELL -1

//+------------------------------------------------------------------+
//| User input variables |
//+------------------------------------------------------------------+
extern string AdvisorName = "Kolier_SuperTrend_Indi";
extern string AdvisorVersion = "1.0.1"; // The version number of this script
extern string ProjectPage = "http://kolier.li/project/kolier-supertrend-indi"; // The project landing page
extern int BarsToCount = 0; // Set to 0 to count all bars, if >0, set more to calculate more bars
extern int TrendMode = 0; // 0=Show line same as SuperTrend.mq4, 1=New way to show trend line
// iATR
extern string ATR_Indicator = "http://kolier.li/example/mt4-iatr-system-average-true-range";
extern int ATR_Period = 10;
extern double ATR_Multiplier = 3.0;

//+------------------------------------------------------------------+
//| Universal variables |
//+------------------------------------------------------------------+
double buffer_line_up[], buffer_line_down[];
double atr, band_upper, band_lower;
int phase=PHASE_NONE;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorShortName(AdvisorName);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));

SetIndexBuffer(0, buffer_line_up);
SetIndexLabel(0, "Up Trend");
SetIndexBuffer(1, buffer_line_down);
SetIndexLabel(1, "Down Trend");

return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int bars_counted = IndicatorCounted();
if(bars_counted < 0) {
return(1);
}
else if(bars_counted > 0) {
bars_counted--;
}
int limit = Bars - bars_counted;
if(BarsToCount>0 && limit>BarsToCount) {
limit = BarsToCount;
}

for(int i=limit; i>=0; i--) {
atr = iATR(Symbol(), 0, ATR_Period, i);
band_upper = (High[i]+Low[i])/2 + ATR_Multiplier * atr;
band_lower = (High[i]+Low[i])/2 - ATR_Multiplier * atr;

if(phase==PHASE_NONE) {
buffer_line_up[i] = (High[i+1]+Low[i+1])/2;
buffer_line_down[i] = (High[i+1]+Low[i+1])/2;
}

if(phase!=PHASE_BUY && Close[i]>buffer_line_down[i+1] && buffer_line_down[i+1]!=EMPTY_VALUE) {
phase = PHASE_BUY;
buffer_line_up[i] = band_lower;
buffer_line_up[i+1] = buffer_line_down[i+1];
}

if(phase!=PHASE_SELL && Close[i]<buffer_line_up[i+1] && buffer_line_up[i+1]!=EMPTY_VALUE) {
phase = PHASE_SELL;
buffer_line_down[i] = band_upper;
buffer_line_down[i+1] = buffer_line_up[i+1];
}

if(phase==PHASE_BUY
&& ((TrendMode==0 && buffer_line_up[i+2]!=EMPTY_VALUE) || TrendMode==1) ) {
if(band_lower>buffer_line_up[i+1]) {
buffer_line_up[i] = band_lower;
}
else {
buffer_line_up[i] = buffer_line_up[i+1];
}
}
if(phase==PHASE_SELL
&& ((TrendMode==0 && buffer_line_down[i+2]!=EMPTY_VALUE) || TrendMode==1) ) {
if(band_upper<buffer_line_down[i+1]) {
buffer_line_down[i] = band_upper;
}
else {
buffer_line_down[i] = buffer_line_down[i+1];
}
}

}

return(0);
}

http://www.wisestocktrader.com/indic...70-super-trend
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to AmiSmart For This Useful Post:
  #28 (permalink)  
Old 13-11-2013, 01:12 PM
s_learner s_learner is offline
Newbie
 
Join Date: Jun 2011
Posts: 4
Thanks: 3
Thanked 2 Times in 2 Posts
s_learner is on a distinguished road
Default

Seniors please convert this mt4 code into AFL with the same time setting facility as it is in this indicator


//+------------------------------------------------------------------+
//| T3 clean.mq4 |
//| mladen |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link "mladenfx@gmail.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue
#property indicator_width1 2

//
//
//
//
//

extern int T3Period = 14;
extern int T3Price = PRICE_CLOSE;
extern double b = 0.618;
extern string TimeFrame = "current time frame";

//
//
//
//
//

double t3Array[];
double ae1[];
double ae2[];
double ae3[];
double ae4[];
double ae5[];
double ae6[];

//
//
//
//
//

int timeFrame;
string IndicatorFileName;


//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+

int init()
{
IndicatorBuffers(7);
SetIndexBuffer(0,t3Array);
SetIndexBuffer(1,ae1);
SetIndexBuffer(2,ae2);
SetIndexBuffer(3,ae3);
SetIndexBuffer(4,ae4);
SetIndexBuffer(5,ae5);
SetIndexBuffer(6,ae6);

//
//
//
//
//
//

timeFrame = stringToTimeFrame(TimeFrame);
IndicatorShortName("T3 Moving Average "+TimeFrameToString(timeFrame)+"("+T3Period+") ");
IndicatorFileName = WindowExpertName();
return(0);
}


//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+

int start()
{
int counted_bars=IndicatorCounted();
int i,limit;


if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;

//
//
//
//
//

if (timeFrame != Period())
{
datetime TimeArray[];
limit = MathMax(limit,timeFrame/Period());
ArrayCopySeries(TimeArray ,MODE_TIME ,NULL,timeFrame);

//
//
//
//
//

for(i=0,int y=0; i<limit; i++)
{
if(Time[i]<TimeArray[y]) y++;
t3Array[i] = iCustom(NULL,timeFrame,IndicatorFileName,T3Period, T3Price,b,0,y);
}
return(0);
}

//
//
//
//
//

CalculateT3(limit,T3Period,T3Price);
return(0);
}

//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//

int t3.period;
double e1,e2,e3,e4,e5,e6;
double c1,c2,c3,c4;
double w1,w2,b2,b3;

//
//
//
//
//

double CalculateT3(int limit,int period,int priceType)
{
if (t3.period != period)
{
t3.period = period;
b2 = b*b;
b3 = b2*b;

c1 = -b3;
c2 = (3*(b2+b3));
c3 = -3*(2*b2+b+b3);
c4 = (1+3*b+b3+3*b2);

w1 = 2 / (2 + 0.5*(MathMax(1,period)-1));
w2 = 1 - w1;
}

//
//
//
//
//

for(int i=limit; i>=0; i--)
{
double price = iMA(NULL,0,1,0,MODE_SMA,priceType,i);
e1 = w1*price + w2*ae1[i+1];
e2 = w1*e1 + w2*ae2[i+1];
e3 = w1*e2 + w2*ae3[i+1];
e4 = w1*e3 + w2*ae4[i+1];
e5 = w1*e4 + w2*ae5[i+1];
e6 = w1*e5 + w2*ae6[i+1];
t3Array[i]=c1*e6 + c2*e5 + c3*e4 + c4*e3;
ae1[i] = e1;
ae2[i] = e2;
ae3[i] = e3;
ae4[i] = e4;
ae5[i] = e5;
ae6[i] = e6;
}
}

//+------------------------------------------------------------------+
//|
//+------------------------------------------------------------------+
//
//
//
//
//

int stringToTimeFrame(string tfs)
{
int tf=0;
tfs = StringTrimLeft(StringTrimRight(StringUpperCase(tfs )));
if (tfs=="M1" || tfs=="1") tf=PERIOD_M1;
if (tfs=="M5" || tfs=="5") tf=PERIOD_M5;
if (tfs=="M15"|| tfs=="15") tf=PERIOD_M15;
if (tfs=="M30"|| tfs=="30") tf=PERIOD_M30;
if (tfs=="H1" || tfs=="60") tf=PERIOD_H1;
if (tfs=="H4" || tfs=="240") tf=PERIOD_H4;
if (tfs=="D1" || tfs=="1440") tf=PERIOD_D1;
if (tfs=="W1" || tfs=="10080") tf=PERIOD_W1;
if (tfs=="MN" || tfs=="43200") tf=PERIOD_MN1;
if (tf<Period()) tf=Period();
return(tf);
}
string TimeFrameToString(int tf)
{
string tfs="";

if (tf!=Period())
switch(tf) {
case PERIOD_M1: tfs="M1" ; break;
case PERIOD_M5: tfs="M5" ; break;
case PERIOD_M15: tfs="M15" ; break;
case PERIOD_M30: tfs="M30" ; break;
case PERIOD_H1: tfs="H1" ; break;
case PERIOD_H4: tfs="H4" ; break;
case PERIOD_D1: tfs="D1" ; break;
case PERIOD_W1: tfs="W1" ; break;
case PERIOD_MN1: tfs="MN1";
}
return(tfs);
}

//
//
//
//
//

string StringUpperCase(string str)
{
string s = str;
int lenght = StringLen(str) - 1;
int char;

while(lenght >= 0)
{
char = StringGetChar(s, lenght);

//
//
//
//
//

if((char > 96 && char < 123) || (char > 223 && char < 256))
s = StringSetChar(s, lenght, char - 32);
else
if(char > -33 && char < 0)
s = StringSetChar(s, lenght, char + 224);
lenght--;
}

//
//
//
//
//

return(s);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #29 (permalink)  
Old 29-01-2014, 03:15 PM
nTupLe2 nTupLe2 is offline
Regulars
 
Join Date: Nov 2013
Location: kolkata+WB/Country
Posts: 216
Thanks: 172
Thanked 144 Times in 96 Posts
nTupLe2 will become famous soon enoughnTupLe2 will become famous soon enoughnTupLe2 will become famous soon enough
Default MT4 to AFL --- Adaptive Parabolic SAR

hi

please convert it to afl.

PFA.
Attached Files
File Type: mq4 AdaptiveParabolic_v2.mq4 (15.2 KB, 14 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #30 (permalink)  
Old 07-07-2015, 05:29 AM
sang25 sang25 is offline
Newbie
 
Join Date: Jul 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sang25 is on a distinguished road
Default

Originally Posted by HarryJobs View Post
Can anybody please convert this afl into mt4?


//---- heikin ashi
HaClose = (O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), .40);
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
xDiff = (HaHigh - Halow) * IIf(StrFind(Name(),"JPY"),100,10000);
barcolor = IIf(HaClose >= HaOpen,colorGreen,colorRed);
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleCandle );
// Plot(EMA(HaClose,9),"",colorWhite, styleLine);
// Plot(EMA(HaClose,18),"",colorBlack, styleLine);
_SECTION_BEGIN("KPL Swing");
//Copyright Kamalesh Langote. Email:kpl@vfmdirect.com. More details at KPL Swing (breakout trading system)
//Save indicator as "kplswing.afl" in C: program files > Amibroker > Formulas > Custom folder and then drap and drop on price chart
no=Param( "Swing", 20, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase); // or styleaArea

Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Bu y,Low,High));
_SECTION_END();

Hi,

Did you got the mq4 for this KPL afl. If so please share to my email id: *** REMOVED ***

Thank you.

Regards,
Sangeetha

Mod Note: Please do not share email id on the forum. Use PM to exchange email ids.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > MetaTrader


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


DPonline

All times are GMT +5.5. The time now is 02:50 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2