Afl writers pls help

mastermind007

Well-Known Member
#31
However , I saw a flaw in the AFL that when a Long signal was generated the Stop loss was mentioned above the entry price and Target price was mentioned below the Entry price. It happened at several long signals .

Whats the name of this AFL and are you sure that you have got from a reliable source ?
Pt1) Did you notice that it rarely generates Sell calls. Anyway, with all AFLs, you must back-test for ur set of scrips and then paper-test for few days forward b4 taking risk with it.

Pt2) Comment out first 4 lines (-95, 95 etc) and see the difference ....

Pt3) UP is defined as EMA(rk6,n); rk6 is confusing soup of OHLC harmonic. DOWN is defined as EMA of up.

Pt4) a small thing but variable name for Sell price is BP. I'd assume it to be BuyPrice. I know that there is no requirement to name variables logically, however it'd take exceptionally genius programmer to write bug-free logic with wrong variable names. So, either original AFL has been edited to make it worthless or it was never correctly
coded in first place.

Pt5) Another thing is that, I fail to see any relevance of that assertion. Can anyone shed any light on this statement? I see it in so many AFLs saying that so-&-so signal came xyz bars ago. Even if it is relevant, I'd prefer that it said with date/time instead of barcounts "last signal came on "01/05/13 10:30 AM".
 
Last edited:
#32
Pt1) Did you notice that it rarely generates Sell calls. Anyway, with all AFLs, you must back-test for ur set of scrips and then paper-test for few days forward b4 taking risk with it. Another thing that I find few AFL saying that so-&-so signal came xyz bars ago.

Pt2) Comment out first 4 lines (-95, 95 etc and see the difference ....

Pt3) UP is defined as EMA(rk6,n); rk6 is confusing soup of OHLC harmonic. DOWN is defined as EMA of up.

Pt4) a small thing but variable name for Sell price is BP. I'd assume it to be BuyPrice. I know that there is no requirement to name variables logically, it'd take exceptionally genius programmer to write bug-free logic with wrong variable names. So, either original AFL has been edited to make it worthless or it was never correctly
coded in first place.

Pt5) Another thing is that, I fail to see any relevance of that assertion. Can anyone shed any light on this statement? I see it in so many AFLs.

Even if it is relevant, I'd prefer that it said with date/time instead of barcounts "last signal came on "01/05/13 10:30 AM".
Very authentically pointed out .

Thanks.
 
#33
pls plot the daily tf signals on 5 min chart


_SECTION_BEGIN("Tops-Bottoms-2-3's");
xx=BarIndex();x=xx;Lx=LastValue(x);
nbar=3;
fc=2;
frat=3;
t=H>Ref(HHV(H,frat),-1) AND Ref(HHV(H,frat),frat)<H;
PHighPrice0=ValueWhen(t,H);
b=L<Ref(LLV(L,frat),-1) AND Ref(LLV(L,frat),frat)>L;
PLowPrice0=ValueWhen(b,L);
p=H>Ref(HHV(H,nbar*fc),-1) AND Ref(HHV(H,nbar),nbar)<=H;
d=L<Ref(LLV(L,nbar*fc),-1) AND Ref(LLV(L,nbar),nbar)>=L;
pk=t OR p; tr=b OR d;

px0=ValueWhen(pk,x,0); tx0=ValueWhen(tr,x,0);
px1=ValueWhen(pk,x,1); tx1=ValueWhen(tr,x,1);
px2=ValueWhen(pk,x,2); tx2=ValueWhen(tr,x,2);
px3=ValueWhen(pk,x,3); tx3=ValueWhen(tr,x,3);
ph0=ValueWhen(pk,H,0); tl0=ValueWhen(tr,L,0);
ph1=ValueWhen(pk,H,1); tl1=ValueWhen(tr,L,1);
ph2=ValueWhen(pk,H,2); tl2=ValueWhen(tr,L,2);
ph3=ValueWhen(pk,H,3); tl3=ValueWhen(tr,L,3);

Disp2=ParamToggle("Display 2-3's Labels","Show|Hide",1);

Disp3=ParamToggle("Color Labels Behind 2-3's","Show|Hide",1);
if(Disp3){
PlotShapes(shapeSquare*tr,IIf(Lx-ValueWhen(tr,x)>nbar,colorLime,colorCustom1),0,L,-10);
PlotShapes(shapeSquare*pk,IIf(Lx-ValueWhen(pk,x)>nbar,ColorRGB(255,160,122),colorCustom1),0,H,10);}

dxhm=14; dxlm=10;dxh=3;dxl=2;dyhm=5;
dylm=3;dyh=5;dyl=15;hm=30;lm=30;
function GetVisibleBarCount()
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
return Min(lvb-fvb,BarCount-fvb);
}
function GfxConvertPixelsToBarX(Pixels)
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
pxchartleft=Status("pxchartleft");
pxchartwidth=Status("pxchartwidth");
fac=pxchartwidth/Pixels;
bar=(lvb-fvb)/fac;
return bar;
}
function GfxConvertPixelToValueY(Pixels)
{
local Miny,Maxy,pxchartbottom,pxchartheight;
Miny=Status("axisminy");
Maxy=Status("axismaxy");
pxchartbottom=Status("pxchartbottom");
pxchartheight=Status("pxchartheight");
fac=pxchartheight/Pixels;
Value=(Maxy-Miny)/fac;
return Value;}

if(Disp2)
{
ll=tr AND tl1<tl2; hl=tr AND tl1>tl2; hh=pk AND ph1>ph2;
lh=pk AND ph1<ph2; dt=pk AND ph1==ph2; db=tr AND tl1==tl2;

miny=Status("axisminy");
maxy=Status("axismaxy");
AllVisibleBars=GetVisibleBarCount();
fvb=Status("firstvisiblebar");
LowMargin=Miny+GfxConvertPixelToValueY(lm);
HighMargin=Maxy-GfxConvertPixelToValueY(hm);
dyllm=GfxConvertPixelToValueY(dylm);
dyhhm=GfxConvertPixelToValueY(dyhm);
dyll=GfxConvertPixelToValueY(dyl);
dyhh=GfxConvertPixelToValueY(dyh);
dxllm=GfxConvertPixelsToBarX(dxlm);
dxhhm=GfxConvertPixelsToBarX(dxhm);
dxll=GfxConvertPixelsToBarX(dxl);
dxhh=GfxConvertPixelsToBarX(dxh);

for(i=0;i<AllVisibleBars;i++)
{
if(ll[i+fvb] AND L[i+fvb]>LowMargin) PlotText("Buy",i+fvb+dxll,L[i+fvb]-dyll,colorBlack);
if(ll[i+fvb] AND L[i+fvb]<=LowMargin) PlotText("Buy",i+fvb+dxll+dxllm,L[i+fvb]-dyllm,colorBlack);
if(hl[i+fvb] AND L[i+fvb]>LowMargin) PlotText("Buy",i+fvb+dxll,L[i+fvb]-dyll,colorBlack);
if(hl[i+fvb] AND L[i+fvb]<=LowMargin) PlotText("Buy",i+fvb+dxll+dxllm,L[i+fvb]-dyllm,colorBlack);
if(db[i+fvb] AND L[i+fvb]>LowMargin) PlotText("Buy",i+fvb+dxll,L[i+fvb]-dyll,colorBlack);
if(db[i+fvb] AND L[i+fvb]<=LowMargin) PlotText("Buy",i+fvb+dxll+dxllm,L[i+fvb]-dyllm,colorBlack);
if(hh[i+fvb] AND H[i+fvb]<HighMargin) PlotText("Sell",i+fvb+dxhh,H[i+fvb]+dyhh,colorBlack);
if(hh[i+fvb] AND H[i+fvb]>=HighMargin) PlotText("Sell",i+fvb+dxhh+dxhhm,H[i+fvb]+dyhhm,colorBlack);
if(lh[i+fvb] AND H[i+fvb]<HighMargin) PlotText("Sell",i+fvb+dxhh,H[i+fvb]+dyhh,colorBlack);
if(lh[i+fvb] AND H[i+fvb]>=HighMargin) PlotText("Sell",i+fvb+dxhh+dxhhm,H[i+fvb]+dyhhm,colorBlack);
if(dt[i+fvb] AND H[i+fvb]<HighMargin) PlotText("Sell",i+fvb+dxhh,H[i+fvb]+dyhh,colorBlack);
if(dt[i+fvb] AND H[i+fvb]>=HighMargin) PlotText("Sell",i+fvb+dxhh+dxhhm,H[i+fvb]+dyhhm,colorBlack);
}}

_SECTION_END();
 

kiran_thiru

Well-Known Member
#34
//+------------------------------------------------------------------+
//| Kaufman.mq4 |
//| Copyright © -2005, by konKop & wellx |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, by konKop,wellx"
#property link "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Sienna
#property indicator_color2 DeepSkyBlue
#property indicator_color3 Gold

//---- input parameters
extern int periodAMA=9;
extern int nfast=2;
extern int nslow=30;
extern double G=2.0;
extern double dK=2.0;

//---- buffers
double kAMAbuffer[];
double kAMAupsig[];
double kAMAdownsig[];

//+------------------------------------------------------------------+

int k=0, cbars=0, prevbars=0, prevtime=0;

double slowSC,fastSC;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,159);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,159);
//SetIndexDrawBegin(0,nslow+nfast);
SetIndexBuffer(0,kAMAbuffer);
SetIndexBuffer(1,kAMAupsig);
SetIndexBuffer(2,kAMAdownsig);


IndicatorDigits(4);

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,pos=0;
double noise=0.000000001,AMA,AMA0,signal,ER;
double dSC,ERSC,SSC,ddK;

if (prevbars==Bars) return(0);

//---- TODO: add your code here
slowSC=(2.0 /(nslow+1));
fastSC=(2.0 /(nfast+1));
cbars=IndicatorCounted();
if (Bars<=(periodAMA+2)) return(0);
//---- check for possible errors
if (cbars<0) return(-1);
//---- last counted bar will be recounted
if (cbars>0) cbars--;
pos=Bars-periodAMA-2;
AMA0=Close[pos+1];
while (pos>=0)
{
kAMAupsig[pos] =NULL;
kAMAdownsig[pos]=NULL;
if(pos==Bars-periodAMA-2) AMA0=Close[pos+1];
signal=MathAbs(Close[pos]-Close[pos+periodAMA]);
noise=0.000000001;
for(i=0;i<periodAMA;i++)
{
noise=noise+MathAbs(Close[pos+i]-Close[pos+i+1]);
}
ER =signal/noise;
dSC=(fastSC-slowSC);
ERSC=ER*dSC;
SSC=ERSC+slowSC;
AMA=AMA0+(MathPow(SSC,G)*(Close[pos]-AMA0));
kAMAbuffer[pos]=AMA;

ddK=(AMA-AMA0);
if ((MathAbs(ddK) > (dK*Point)) && (ddK > 0)) kAMAupsig[pos] =AMA;
if ((MathAbs(ddK)) > (dK*Point) && (ddK < 0)) kAMAdownsig[pos]=AMA;

AMA0=AMA;
pos--;
}
//----
prevbars=Bars;
return(0);
}


seniors the above script is kaufman mt4 indicator. chart is below. i want it in ami. there is kaufman & 18 days ma. i want only kaufman line with dots. pls convert this. thank you

 

Similar threads