# AFL coding help needed ! Thanks !

#### robotsolution

##### New Member
Hi Sultan
Can you share me the afl formula of zzzz/d2 that i saw in your Image shack
and how to set up and find the result like your picture .Thanks

#### fansami

##### New Member
MIDAS TOP/BOTTOM FINDER

//

SetBarsRequired(sbrAll);

sd = ParamDate("Input Date","2012-02-14",0);
st=ParamTime("input time","1:44",0);
dn = DateNum();

start = dn == sd AND tn==st;

mp = ParamField("Price field",-1);

PV1= Cum(mp * V);
CV1= Cum( V );

D=Param("D",6120000000,50000,9000000000000);

PV=PV1-ValueWhen(sd==dn AND tn==st,PV1,1);
CV=CV1-ValueWhen(sd==dn AND tn==st,CV1,1);

E=CV*(1-CV/D);

ET=CV-E;

startloop=EndValue(ValueWhen(sd==dn AND tn==st,BarIndex(),1));
endloop=EndValue(IIf(CV>D,ValueWhen(CV<D,BarIndex( ),1),BarCount));

barint=0;

TBF=mp;

for (j=startloop+1;j<endloop;j++)
{
k=0;
i=startloop+1;
while (ET[j]>0 AND k==0)
{

if (CV>ET[j])
{
k=1;

}
i=i+1;
}

if (k==1)
{
barint[j]=i-1;
}

Volint[j]=CV[barint[j]]-ET[j];
Mpint[j]=Low[barint[j]]*Volint[j];

CVint[j]=CV[j]-CV[barint[j]]+Volint[j];
PVint[j]=PV[j]-PV[barint[j]]+Mpint[j];
TBF[0]=Low[0];
TBF[j]=PVint[j]/CVInt[j];

}

PCT=100*CV/D;

tbf2=IIf(BarIndex()<endloop,TBF1,Null);

Plot(TBF2,"PCT="+WriteVal(PCT,1.0)+"TBF",ParamColo r( "Color", colorCycle ), ParamStyle("Style") );

//

(Coded in AMIBROKER by me)

WORD OF CAUTION----- this is a very sophisticated tool pinpointing the end of a trending move and usually used either to book profits or to add positions------ do not use it without going through LEVINE's basic lessons on MIDAS ( freely available on web) and/or David Hawkins and Andrew Coles work

Wildeazoscar,

Did you run your AFL coding for levine's TBF? I copied your program but I do not get anything print out , can you help me to resolve this problem pls ?

Best regards,

Ha

#### vijay_gupta1

##### Banned
helo my seniors and afl experts I have also a
problem regarding afl..
I want 1 simple afl with reminder in
amibrocker for only bullish and bearish
engulfing pattern ..only this 2 candle
sticks...nd also reconfirm this pattern with
just next third candle condition which means
3rd candle also close previous candle high
when bullish engulfing and vice versa..plz help
me all as soon as possible

#### fansami

##### New Member
Wildeazoscar,

Did you run your AFL coding for levine's TBF? I copied your program but I do not get anything print out , can you help me to resolve this problem pls ?

Best regards,

Ha

#### sr114

##### Well-Known Member
Wildeazoscar,

Did you run your AFL coding for levine's TBF? I copied your program but I do not get anything print out , can you help me to resolve this problem pls ?

Best regards,

Ha
U can do 1 thing to get the chart.
carefully choose the start date - (its a trial and error process) - u will get the line

its coming be choosing the start date

rgds
subroto

n.b.- also u can change the start date with DateNUM() function - sp that when u click the bar the charts will be there. also put the plotting of the close price [ plot(C,"",colorgreen,64); ] to get the overall chart

Last edited:

#### fansami

##### New Member
U can do 1 thing to get the chart.
carefully choose the start date - (its a trial and error process) - u will get the line

its coming be choosing the start date

rgds
subroto

n.b.- also u can change the start date with DateNUM() function - sp that when u click the requisiet bar the charts will be there. also put the plotting of the close price [ plot(C,"",colorgreen,64); ] to get the overall chart

Thank you Sir. but I don't find the differenc between TBF and MIDAS when I get the chart,why?

#### fansami

##### New Member
Dear Zultan,

I managed to find a chart for Midas (Purple) and TFinder(Red).

You can see the topfinder can predict the top quite well and therefore I am interested to try to code it in Amibroker.

Any help from experts are appreciated !

Thanks...

AK
I don't find the differenc between TBF and MIDAS when I get the chart,why?

#### sr114

##### Well-Known Member
I don't find the differenc between TBF and MIDAS when I get the chart,why?
Midas - its equivalent to the vwap and the TBF is the average

so if u get the tbf then its ok.

to get the TBF and Midas in a single chart , try to incorporate or add Midas afl written by Thomasz or search in TASC Sept 2008 issue (Midas indicator).

rgds
subroto

Last edited: