![BB-MACD Daytrade](http://amibrokerchart.com/wp-content/uploads/2023/09/BB-MACD-Daytrade-1.png)
BB-MACD Daytrade
The BB-MACD Daytrade AFL combines Bollinger Bands and MACD indicators, using Amibroker data for precision. Traders benefit from timely and accurate insights, allowing them to make well-informed decisions. The BB-MACD Daytrade AFL leverages Amibroker data to optimize entries and exits, enhancing the potential for profitable day trading.
r1 = Param("Fast avg", 3, 3, 30, 1 ); r2 = Param("Slow avg", 6, 6, 60, 1 ); r3 = Param("Signal avg", 2, 2, 10, 1 ); BBPeriods = Param("BB Periods", 14, 2, 60, 1 ); BBPeriods2 = Param("BB2 Periods", 60, 30, 90, 1 ); BBWidth = Param("BB Width", 1.9, 1.7, 2.2, 0.05 ); BBColor = ParamColor("BB Color", colorBlue ); BBStyle = ParamStyle("BB Style", styleDashed+styleNoLabel); BBColor2 = ParamColor("BB2 Color", colorOrange ); BBStyle2 = ParamStyle("BB2 Style", styleDashed+styleNoLabel); GraphXSpace = Param("GraphXSpace",6,0,100,1); P=MACD(r1,r2); //PSignal=EMA(P,r3); PSignal=EMA(P,r3) + (EMA(P,r3) - EMA(EMA(P,r3),r3)); UpZone=BBandTop(P, BBPeriods, BBWidth ); LwZone=BBandBot(P, BBPeriods, BBWidth ); MidZone=(Upzone+LwZone)/2; UpZone2=BBandTop(P, BBPeriods2, BBWidth ); LwZone2=BBandBot(P, BBPeriods2, BBWidth ); MidZone2=(Upzone2+LwZone2)/2; OB = StDev(P, 1000); OS = -1 * StDev(P, 1000); Plot(P, _DEFAULT_NAME(), ParamColor( "Color", colorRed ), ParamStyle( "Style", styleThick ) ); Plot(OB, "OB", colorRed, styleNoLabel ); Plot(OS, "OS", colorGreen, styleNoLabel ); Plot(UpZone, "UpZone", BBColor, BBStyle); Plot(LwZone, "LwZone", BBColor, BBStyle); Plot(UpZone2, "UpZone2", BBColor2, BBStyle2); Plot(LwZone2, "LwZone2", BBColor2, BBStyle2); Plot(MidZone, "MidZone", BBColor, BBStyle); Plot(MidZone2, "MidZone2", BBColor2, BBStyle2); Plot(1, "", IIf( CCIa(P, 2) > 0, colorPaleGreen, colorPink), styleOwnScale|styleArea|styleNoLabel, 0, -5); SetPositionSize( 10, spsPercentOfEquity ); SetBacktestMode( backtestRegularRawMulti ); // allow multiple positions SetTradeDelays( 1, 1, 1, 1 ); Buy = LLV(P,r3) < OS AND (Cross(P, LwZone) OR Cross(P, LwZone2) OR Cross(P, Psignal)); Short = HHV(P,r3) > OB AND (Cross(UpZone, P) OR Cross(UpZone2, P) OR Cross(Psignal, P)); Sell=Short; Cover=Buy; Filter=Buy OR Short; AddColumn(Buy, "Long"); AddColumn(Short, "Short"); AddColumn(C, "Close"); shape = IIf(Buy OR Cover, shapeUpArrow, IIf(Short OR Sell, shapeDownArrow, 0 ) ); shapecolor=IIf(Buy, colorGreen, IIf(Short, colorRed, colorBlack ) ); PlotShapes( shape, shapecolor,0, P );