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 ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Bollinger range trade for Amibroker (AFL)

Rating:
3 / 5 (Votes 2)
Tags:
amibroker, bands

This Bollinger band range trade well suited for range bound market and trend market

Screenshots

Similar Indicators / Formulas

%B of Bollinger Bands With Adaptive Zones
Submitted by kaiji almost 10 years ago
Trend Bands
Submitted by rogercraft over 9 years ago
Bollinger - Keltner Bands
Submitted by kaiji almost 10 years ago
Bollinger %B
Submitted by konidena over 9 years ago
Bollinger Band Squeeze & Expansion
Submitted by razasia over 9 years ago
Jurik's Spandex Band
Submitted by xavier about 8 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Tpo Counts");
PlotOHLC(O,H,L,C,"Price",colorBlack,styleCandle);
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 300, 1, 10 );

TickSize=Param("Tick Rate",0.0001,0.0001,1,0.01);
//slopes
isSlopeUP=(MA( P, Periods )<L) AND Ref(MA( P, Periods ),-1)>Ref(MA( P, Periods ),-2) AND Ref(MA( P, Periods ),-2)>Ref(MA( P, Periods ),-3) AND Ref(MA( P, Periods ),-3)>Ref(MA( P, Periods ),-4);// AND Ref(MA( P, Periods ),-4)>Ref(MA( P, Periods ),-5) AND Ref(MA( P, Periods ),-5)>Ref(MA( P, Periods ),-6);
isSlopeDN=(MA( P, Periods )>H) AND Ref(MA( P, Periods ),-1)<Ref(MA( P, Periods ),-2) AND Ref(MA( P, Periods ),-2)<Ref(MA( P, Periods ),-3) AND Ref(MA( P, Periods ),-3)<Ref(MA( P, Periods ),-4);// AND Ref(MA( P, Periods ),-4)<Ref(MA( P, Periods ),-5) AND Ref(MA( P, Periods ),-5)<Ref(MA( P, Periods ),-6);
isSlpeUP=(MA( P, Periods )<C) AND Ref(MA( P, Periods ),-1)>Ref(MA( P, Periods ),-2) AND Ref(MA( P, Periods ),-1)>Ref(MA( P, Periods ),-3) AND Ref(MA( P, Periods ),-1)>Ref(MA( P, Periods ),-4) AND Ref(MA( P, Periods ),-1)>Ref(MA( P, Periods ),-5) AND Ref(MA( P, Periods ),-1)>Ref(MA( P, Periods ),-6);
isSlpeDN=(MA( P, Periods )>C) AND Ref(MA( P, Periods ),-1)<Ref(MA( P, Periods ),-2) AND Ref(MA( P, Periods ),-1)<Ref(MA( P, Periods ),-3) AND Ref(MA( P, Periods ),-1)<Ref(MA( P, Periods ),-4) AND Ref(MA( P, Periods ),-1)<Ref(MA( P, Periods ),-5) AND Ref(MA( P, Periods ),-1)<Ref(MA( P, Periods ),-6);
sa = ((LinRegSlope(C,20))/C)*100;



Plot(round(MA( P, Periods )/TickSize)*TickSize , _DEFAULT_NAME(), colorLightGrey, 1 ); 
Width = Param("Width", 2, 0, 10, 0.05 );
Plot( bbt = round(BBandTop( P, Periods, Width )/TickSize)*TickSize, "BBTop" + _PARAM_VALUES(), colorLightGrey, 1); 
Plot( bbb = round(BBandBot( P, Periods, Width )/TickSize)*TickSize, "BBBot" + _PARAM_VALUES(), colorLightGrey,4096 ); 
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( colorDarkGrey, colorWhite, 0.9 ), styleCloud, Null, Null, Null, -1 );



PositionSize=50000;
Buy  = Ref(L<bbb,-2) AND Ref(C>bbb,-1);
Short=Ref(H>bbt,-2)  AND Ref(C<bbt,-1);








Buyst=ValueWhen(Buy,O,1);
Shortst=ValueWhen(Short,O,1);

Sell=  Cross(Buyst*0.995,C) ;
Cover=  Cross(C,Shortst*1.005);

Buy=ExRem(Buy,Short) OR ExRem(Buy,Sell) ;
Short=ExRem(Short,Buy) OR ExRem(Short,Cover);
Sell=ExRem(Sell,Buy);
Cover=ExRem(Cover,Short);

PlotShapes(IIf(Short,shapeDownArrow,shapeNone),colorRed,0,H,-10); 
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L,-10);

PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorOrange,0,H,-10); 
PlotShapes(IIf(Cover,shapeUpArrow,shapeNone),colorBlue,0,L,-10);


Title =StrFormat("{{DATE}} Op %g, Hi %g, Lo %g, Cl %g (%.1f%%) ", O, H, L, C, SelectedValue( ROC(C,1)) )+
Comm2=("\n"+"Slope:      ")+
WriteIf(isSlopeUP,EncodeColor(colorBrightGreen)+"+Up",
WriteIf(isSlopeDN,EncodeColor(colorRed)+"-Down",EncodeColor(colorBlue)+"< Flat >"));

1 comments

1. worldastro

error in code in my ami 5.20

Leave Comment

Please login here to leave a comment.

Back