Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
BB and Keltner Squeeze for Amibroker (AFL)
Rating:
5 / 5 (Votes 1)
Tags:
amibroker, bands, alerts
Bollinger bands and Keltner bands squeeze formula
Similar Indicators / Formulas
%B of Bollinger Bands With Adaptive Zones
Submitted
by kaiji about 15 years ago
Bollinger %B
Submitted
by konidena almost 15 years ago
Bollinger - Keltner Bands
Submitted
by kaiji about 15 years ago
Trend Bands
Submitted
by rogercraft almost 15 years ago
Bollinger Band Squeeze & Expansion
Submitted
by razasia almost 15 years ago
Indicator / Formula
Copy & Paste Friendly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | // FROM AMIBROKER FORUMS Here we go: _SECTION_BEGIN ( "Squeesy" ); /* BB Squeeze (conversion for TS code) Instructions Insert Linked to new chart pane Periods can be selected in Param window */ Price = Close ; Length = Param ( "Length" ,20,2,100,1); // { Length for Average True Range (ATR)} Lenght1 = Param ( "Length1" ,20,2,100,1); // { Std. Deviation (SD) Calcs } nK = Param ( "Channel ATRs" ,1.5,0.1,2,0.1); //{ Keltner Channel ATRs from Average } nBB = Param ( "BB Std Devs" ,2,0.1,3,0.1); // { Bollinger Band Std. Devs. from Average } AlertLine = Param ( "AlertLine" ,1,0,3,1); //{ BBS_Index level at which to issue alerts } NormalColor = colorRed ; //{ Normal color for BBS_Ind } AlertlColor = colorBlue ; //{ Color for BBS_Ind below alert line } LHMult = Nz (PointValue/TickSize); //{-- Calculate BB Squeeze Indicator ----------------------} AvgTrueRange = ATR (Length); SDev = StDev (Price, Length); Denom = nK*AvgTrueRange; BBS_Ind = Nz ((nBB * SDev) /Denom); SetPlotColor = IIf ( BBS_Ind < Alertline, NormalColor, AlertlColor); BBcrossDown = Cross (AlertLine,BBS_Ind); BBcrossUp = Cross (BBS_Ind,AlertLine); SetChartOptions ( 0, chartShowDates | chartWrapTitle ); GraphXSpace =10; //_N(Title = "{{NAME}} - {{INTERVAL}} {{DATE}} "+_DEFAULT_NAME()+" : {{OHLCX}} {{VALUES}}"); //+"\nALERT: "+WriteIf(BBcrossDown,"BB Squeeze Alert",WriteIf (BBcrossUp,"BB Squeeze Is Over","")) ); //{-- Plot the Index & Alert Line -------------------------} Plot (0, "BBS_Ind" , SetPlotColor, styleDots ); //{-- Plot delta of price from Donchian mid line ----------} value2 = LinearReg ( price-(( HHV ( H , Lenght1)+ LLV ( L , Lenght1))/2+ MA ( C ,Lenght1))/2, Lenght1); color = IIf ( value2 > 0, IIf ( value2 > Ref (value2,-1), colorGreen , colorDarkGreen ), IIf ( value2 < 0, IIf ( value2 < Ref (value2,-1), colorRed , colorDarkRed ), colorYellow )); Plot (value2*LHMult, "NickmNxtMove" , color, styleArea ); Plot (value2, "BB Squeeze" ,color, styleArea ); //{-- Issue Alert when the Squeeze is On ------------------} "ALERT" ; //Write alerts to Interpretation window //Ticker = Name(); //WriteIf(BBcrossDown,Ticker + " " + "BB Squeeze Alert" ,WriteIf (BBcrossUp,Ticker + " " + "BB Squeeze Is Over","")); //Write alerts to Alert Output window AlertIf (BBcrossDown, "" , "BB Squeeze Alert" ,0); AlertIf (BBcrossUp, "" , "BB Squeeze Is Over" ,0); //Sound alerts //AlertIf( BBcrossDown, "SOUND C:\\Windows\\Media\\RINGIN.WAV", "Audio alert", 2 ); //AlertIf( BBcrossUp, "SOUND C:\\Windows\\Media\\RINGIN.WAV", "Audio alert", 2 ); //Write text to screen /* for(i=1;i<BarCount;i++) { if(BBcrossDown[i]) { PlotText("BB Squeeze Alert",i,-6,colorWhite); } if(BBcrossUp[i]) { PlotText("BB Squeeze Is Over",i,-3,colorWhite); } } */ PlotShapes ( shapeUpArrow *BBcrossDown, colorBrightGreen ,0,0); PlotShapes ( shapeDownArrow *BBcrossup, colorBrightGreen ,0,0); _SECTION_END (); |
3 comments
Leave Comment
Please login here to leave a comment.
Back
can anyone modify the buy sell signal according this
:-
bb period : 20
bb width : 1
buy : close abv upper band
sell: close below lower band
how to use this??
Ref: https://www.youtube.com/watch?v=v2pbrz9K7X8 ( TTM Squeeze how to use )
Superb codeā¦.hunted for this ages for Amibroker!!
Great share!!