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

[amibroker] The Reverse Engine Bollinger Bands Problem



PureBytes Links

Trading Reference Links




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


  ADVERTISEMENT 









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 the Yahoo! Terms of Service.



Attachment:
RevEngBBandBot.gif

Attachment: Description: "Description: GIF image"