PureBytes Links
Trading Reference Links
|
Thanks for the response. Yes, I did use (paste) the formula. I'm just
trying to understand the logic behind it. Let me clarify a bit more
on what I was trying to say.
Let me first talk about the second point that I raised. So you do NOT
want a fluctuating min f value? I thought you would, because
otherwise the 95% capture would happen only for last 100 bars, which
is Ok in real time, but not in say, a backtest. For example, when I
plot the formula, I see perc is 95% or greater for last 100 bars, but
not necessarily for bars before that. Was that the intent? If yes,
then its OK.
Re. first point, what I was trying to say is that why figure out a
coeff for BBands calcualted over "n" periods that captures 95% of the
values over "Lookback" periods which is greater than n? Even if you
put aside the argument that 2X doesn't always give you 95% (see
below), why not just calculate BBands for Lookback periods and figure
out a coeff for those which capture 95% of the prices for Lookback?
Is there any reason for choosing a "different" n periods to calculate
the coeff for?
Thirdly, and now this is VERY surprising. When I plot a simple 2X of
a BBand like below -
-------------------------------
SetBarsRequired(10000, 10000);
n=20;
newbB=BBandBot(C,n,2);
newbT=BBandTop(C,n,2);
newperc=100*Sum(C>=newbB AND C<=newbT,n)/n;
Plot(C,"C",1,64);
Plot(newbB,"BB",colorLightYellow,8);
Plot(newbT,"BT",colorLightYellow,8);
Plot(newperc,"Perc",colorLightBlue,8);
--------------------------------
- you are right that newperc sometimes dips below 95? How come? Isn't
2 times standard deviation supposed to capture 95% of the values in a
given dataset, which is values over last n periods? Does anyone know
why it would dip below 95%?
Jitu
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
wrote:
> Find some comments below:
> --- In amibroker@xxxxxxxxxxxxxxx, "jtelang" <jtelang@xxxx> wrote:
> > Hi Dimitris,
> >
> > A bit confused about couple of things here... Hope you can
clarify.
> >
> > 1. BBands are calculated as standard deviation, so by definition,
2
> > times BBands is supposed to capture 95% of the values over
periods
> > specified.
>
> No, it is not true.
> The percentage x is given by
>
> Lookback=100;n=20;
> bB=BBandBot(C,n,2);
> bT=BBandTop(C,n,2);
> x=100*Sum(C>=bB AND C<=bT,Lookback)/Lookback;
>
> Explore your database and you will see that x is not equal to 95.
> This is exactly what my code searches: to find the proper f that
will
> make this percentage equal to 95%.
>
> >In your formula below, if you make Lookback equal to n,
> > then theorotically the f min value should always be equal to 2,
no
> > less, no more. Is that assumption correct? If yes, then couldn't
> you
> > simply calculate BBands over Lookback periods with 2 as
multiplier,
> > giving you the same values as calculated below?
> >
> > 2. In the for loop below, when you use "x[BarCount-1]" to
compare,
> > what are you assuming BarCount value to be? "BarCount-1" will
> always
> > give you the last value in the array, no?
>
> I agree.
>
> >Furthermore, as TJ
> > explained to me earlier in another thread, the BarCount value
> > fluctuates when QuickAFL mode is on.
>
> I didnīt follow this reply you refer but I donīt see anything
> flactuating in my results. Did you notice something similar ?
>
> >So if you add "SetBarsRequired
> > (10000, 10000)" at the top of your formula to correct it, you'll
> > notice that your min f value is a constant.
>
> I do not use SetBarsRequired in this code.
>
> To avoid confusion [?] with barcount, replace this line with
>
> if(x[LastValue(Cum(1))-1]<=perc)
>
> It will give the same result.
> > TIA,
> >
> > Jitu
> In general, paste the code and see how it works [because it works]
> and then arrange it according to your standards.
> Dimitris Tsokakis
> > --- In amibroker@xxxxxxxxxxxxxxx, "Dimitris Tsokakis"
> <TSOKAKIS@xxxx>
> > wrote:
> > >
> > > Paste in Inicator builder the
> > >
> > > // Adjustable Bollinger bands
> > > n=20;
> > > Lookback=100;
> > > perc=95;
> > > for(f=1.5;f<3;f=f+0.01)
> > > {
> > > bB=BBandBot(C,n,f);bT=BBandTop(C,n,f);
> > > x=100*Sum(C>=bB AND C<=bT,Lookback)/Lookback;
> > > if(x[BarCount-1]<=perc)
> > > {
> > > g=f;
> > > }
> > > }
> > > newbB=BBandBot(C,n,g);
> > > newbT=BBandTop(C,n,g);
> > > newperc=100*Sum(C>=newbB AND C<=newbT,Lookback)/Lookback;
> > > Plot(C,"",1,64);Plot(newbB,"",colorLightYellow,8);Plot
> > (newbT,"",colorLightYellow,8);
> > > Plot(BBandBot(C,n,2),"",colorRed,1);Plot(BBandTop
> > (C,n,2),"",colorRed,1);
> > > Title="f min="+WriteVal(g,1.2)+",perc="+WriteVal(newperc,1.0)
+"%";
> > >
> > > The formula will find the f min necessary for the 95%
confidence,
> > > will plot the new BBands and, for comparison, will plot the
usual
> > f=2 BBlines.
> > > It is interesting to see fminCSCO=2.09 but fminBEAS=2.70.
> > > You may adjust n, Lookback and perc.
> > > Dimitris Tsokakis
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Remanufactured Ink Cartridges & Refill Kits at MyInks.com for: HP $8-20. Epson $3-9, Canon $5-15, Lexmark $4-17. Free s/h over $50 (US & Canada).
http://www.c1tracking.com/l.asp?cid=6351
http://us.click.yahoo.com/0zJuRD/6CvGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|