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

[amibroker] Re: The Reverse Engine Bollinger Bands Problem, II



PureBytes Links

Trading Reference Links

Hi,

This could be useful if used in conjunction with Gann Support & 
Resistance points and may help in deciding whether to enter at 
Low/High (Support/Resistance)of Day or at the Market On Open 
(Previous Days Market On Close) depending on the prediction of the 
close price.

Of course, it also depends on whether your Entry/Exit signal system 
is designed to enter at MOO at all times (like mine) in which case 
you just have to wait for a stronger signal....

Need to do more research.  Thanks.  Nice piece of work.

Regards,

Pal

--- In amibroker@xxxxxxxxxxxxxxx, "Dimitris Tsokakis" <TSOKAKIS@xxxx> 
wrote:
> Here is the complete IB formula for BBandTop, BBandbot.
> 
> // Anticipating the next bar BBandBot or BBandTop cross, by D. 
Tsokakis, Sept 2003
> n=20; f=2;
> Qn=Sum(C^2,n);Qn_1=Sum(C^2,n-1);
> Sn=Sum(C,n);Sn_1=Sum(C,n-1);
> Mn=Sn/n;Mn_1=Sn_1/(n-1);
> Kn=(1/n)*sqrt(n*Qn-Sn^2);Kn_1=(1/(n-1))*sqrt((n-1)*Qn_1-Sn_1^2);
> bb=Mn-f*Kn;bt=Mn+f*Kn;
> S=Sn_1;Q=Qn_1;
> A2=(n-1)*(f^2-n+1);
> A1=-2*(f^2+1-n)*S;
> A0=f^2*n*Q-f^2*S^2-S^2;
> x1=(-A1-sqrt(A1^2-4*A2*A0))/(2*A2);
> x2=(-A1+sqrt(A1^2-4*A2*A0))/(2*A2);
> Plot(C,"C",1,8);
> Plot(X1,"",colorBlue,1);
> Plot(X2,"",colorBlue,1);Plot(bb,"BBandBot",7,1);Plot
(bt,"BBandTop",7,1);
> PlotShapes(shapeDownTriangle*Cross(x2,Ref(C,1)),colorPink);
> PlotShapes(shapeDownArrow*(Cross(bb,C)),colorRed);
> PlotShapes(shapeUpTriangle*Cross(Ref(C,1),x1),colorAqua);
> PlotShapes(shapeUpArrow*(Cross(C,bt)),colorBrightGreen);
> Title="The next "+Name()+" Close should be "+"\n *below"+WriteVal
(x2)+" for a BBandBot Cross"+
> "\n *above"+WriteVal(x1)+" for a BBandTop Cross"+
> "\n  Actual Next Close = "+WriteIf(Cum(1)!=LastValue(Cum
(1)),WriteVal(Ref(C,1)),"?");
> 
> The formula gives quite accurate results. Sometimes it is useful.
> At point Z1, the price should be below 13.845 and the next bar 
close was 13.840.
> At point Z2, the price should be above 20.840 and the next bar 
close was 20.850.  
> From the mathematical point of view, both crosses come from the 
same 2nd degree equation A2*X^2+A1*X+A0=0
> Dimitris Tsokakis
> [to be continued]
> 
> ----- Original Message ----- 
> From: Dimitris Tsokakis 
> To: amibroker@xxxxxxxxxxxxxxx 
> Sent: Monday, September 22, 2003 11:26 AM
> Subject: The Reverse Engine Bollinger Bands Problem
> 
> 
> What is the necessary next bar Close to see prices below the next 
bar BBandbot ?
> Steve Karnish is responsible for the question [and 
the ...headache], some time ago.
> The following code is dedicated to him.
> Paste in IB the
> 
> // Anticipating the next bar BBandbot cross, by D. Tsokakis, Sept 
2003
> n=10; 
> f=2;
> Qn=Sum(C^2,n);Qn_1=Sum(C^2,n-1);
> Sn=Sum(C,n);Sn_1=Sum(C,n-1);
> Mn=Sn/n;Mn_1=Sn_1/(n-1);
> Kn=(1/n)*sqrt(n*Qn-Sn^2);Kn_1=(1/(n-1))*sqrt((n-1)*Qn_1-Sn_1^2);
> b=Mn-f*Kn;
> S=Sn_1;Q=Qn_1;
> A2=(n-1)*(f^2-n+1);
> A1=-2*(f^2+1-n)*S;
> A0=f^2*n*Q-f^2*S^2-S^2;
> x2=(-A1+sqrt(A1^2-4*A2*A0))/(2*A2);
> Plot(X2,"",colorBlue,1);Plot(C,"C",1,8);Plot(b,"BBandBot",7,1);
> PlotShapes(shapeUpArrow*Cross(x2,Ref(C,1)),colorWhite);
> PlotShapes(shapeDownArrow*(Cross(b,C)),colorRed);
> Title="The next "+Name()+" Close should be <="+WriteVal(x2)+
> "\nActual Next Close = "+WriteIf(Cum(1)!=LastValue(Cum(1)),WriteVal
(Ref(C,1)),"?");
> 
> The solution is the X2 array.
> For visual verification, a white arrow is plotted when the X2 
crosses the next bar close and a red arrow points the actual cross.
> 
> Dimitris Tsokakis
> [to be continued]


------------------------ Yahoo! Groups Sponsor ---------------------~-->
ReplayTV: Control live television
Special Sale: 50% off ReplayTV
CNet Ranked #1 over Tivo!
http://us.click.yahoo.com/aUMW7B/A6qGAA/ySSFAA/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/