[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can amibroker AFL detect support resistance levels ?



PureBytes Links

Trading Reference Links

Here is the Exploration

x = Cum(1);
per = 3;
s11=H;
pR = PeakBars( s11, per, 1 ) == 0;
endt1= LastValue(ValueWhen( pR, x, 1 ));
startt1=LastValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = LastValue(ValueWhen( pR, s11, 1 ) );
startR = LastValue( ValueWhen( pR, s11, 2 ));
dH=endR-startR;
Filter=endt1<=LastValue(x)-10 
AND 
endt1>=LastValue(x)-20 
AND 
dtr>=5 
AND 
dtr<=30 
AND 
abs(dH)<0.1*endR;
NumColumns=3;
Column0=endR;Column0Name="Last Peak";
Column1=startR;Column1Name="Previous Peak"; 
Buy=Cum(1)==startt1;
Sell=Cum(1)==endt1;

Notes :
1. From per=3 you calibrate the sensitivity of peak recognition
2. Buy and Sell are just for the visual part, to see your points.
3. I ask in abs(dH)<0.1*endR the vertical distance between peaks
to be less than 0.1 of the last peak.
You may change this with
abs(dH)<0.15
but you are restricted enough.(For a stock with values around 1$ is
big, for IBM is very small.
4. Explore all stocks for the last day of your data.
Dimitris Tsokakis

--- In amibroker@xxxx, man581@xxxx wrote:
> 
> > 
> > Have you checked AFL Library?
> > Have fun,
> > Marek
> 
> 
> Putting it in other amibroker words, I think it might be MUCH 
easier 
> to do it this way:
> 
> -Distance from today to last peak (in days) >=10, =< 20
> -Distance from last peak to two peaks ago (in days) >=5, =< 30
> -Vertical distance between the two peaks should be < 0.15$
> 
> I think it will be much easier to do it this way.
> I will try to explore the AFLs and the link you provided in the 
other 
> message to try to build this up. Meanwhile if someone wants to 
> help... i'll be glad to see this working.
> 
> Email