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

Re: AFL- Needs help( bband range with variable percentage).



PureBytes Links

Trading Reference Links

hi brian.
this seems to look more promising.
I have modified this formula so that you can choose a value for the 
percentage differense you would like the bbands to narrow.
I have thought of a few ways to do this and using the LLV of 10 
days probably will not get the results you want.
As it may narrow more after the signal is true and the question 
you asked was for the bband contraction to be at its llv 10.

so what i did was to use the HHV 10 diff of the high bband and the 
low bband and take a percentage of this to use as the value that the 
range of the bband contraction should be below. 

the reason i did this was that if i used a fixed value certain 
stocks could trigger while the diff of the bband range was not to far 
from the previous range as some stocks did not have a huge variation 
in their high to low range of the bband and vice versa.
so i needed to use something in the actual individual stock to 
use due to each stock having its own character. 

adjust the diff value as you want .
you can use it in the indi builder or run it in the explorer.

when running an exploration and the befafter variable is set to 
1, it will find the stocks with the true condition but a day after 
the true value is not true anymore, 
changing the value of the befafter variable to zero will find the 
true cond a day after its true. 



diffvalue=0.3;
befAfter=1;//0=1Day After True, 1=1 Day After NOT True. 
bbtop = BBandTop(Close, 35, 2);
bbbot = BBandBot(Close, 35, 2);

Aa=bbtop-bbbot;
gg=IIf(aa>Ref(HHV(Aa,10),-1),1,0);
gg2=ValueWhen(gg==1,Aa,1);
Cc2=gg2*diffvalue;
bb3=IIf(Aa<Cc2,1,0);
dd=IIf(BarsSince(bb3==befAfter)==1,1,0);
Plot(bbbot,"",4+bb3,4);
Plot(bbtop,"",4+bb3,4);
Plot(C,"",1,64);

Filter = Close > 0 AND Close < 25 AND Volume > 5000 AND dd==1;

AddColumn(C,"close");
AddColumn(Aa,"bbanddiff");
AddColumn(dd,"dd");
AddColumn(V,"volume");
AddColumn(RSI(),"rsi");
AddColumn(ADX(),"adx");

I gave it a run on the ASX and only came up with 8 stocks.

cheers: john.

--- In amibroker@xxxx, "Brian Elijah" <cadvantag@xxxx> wrote:
> I was looking to find volatility or extreme tightness/contraction 
with the bands. This exploration returned no stocks
> 
> Basically I wanted yesterday to be the point of lowest distance 
between the bands over the past 10 days- How can I adjust this AFL.
> 
> Thanks in Advance,
> 
> Brian
> 
> 
> 
> bbtop = BBandTop(Close, 35, 2);
> 
> bbbot = BBandBot(Close, 35, 2);
> 
> Yesterdaybbtop = Ref( MA( bbtop, 50 ), -1 );
> 
> Yesterdaybbbot = Ref( MA( bbbot, 50 ), -1 );
> 
> Yesterdaybbtopp = Ref( MA( bbtop, 50 ), -10 );
> 
> Yesterdaybbbott = Ref( MA( bbbot, 50 ), -10 );
> 
> 
> bandlow = LLV( MA( bbtop, 50 ), -1 );
> 
> bandhigh = HHV(MA( bbbot, 50 ), -1 );
> 
> bandlowa = LLV( MA( bbtop, 50 ), -10 );
> 
> bandhighb = HHV(MA( bbbot, 50 ), -10 );
> 
> Filter = Close > 0 AND Close < 25 AND Volume > 5000 AND 
(Yesterdaybbtop + Yesterdaybbbot < Yesterdaybbtopp + Yesterdaybbbott) 
AND (bandlow + bandhigh) < (bandlowa + bandhighb);
> 
> 
> NumColumns = 4;
> 
> Column0 = Close;
> 
> Column0Name = "Close";
> 
> 
> Column1 = Volume;
> 
> Column1Name = "Volume";
> 
> Column2 = RSI();
> 
> Column2Name = "RSI";
> 
> Column3 = ADX();
> 
> Column3Name = "ADX";