// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN ("BB-MACD"); SetChartBkColor( colorBlack ) ; A1=EMA(C,4)-EMA(C,34); BBtop=BBandTop(A1,10,1); BBbot=BBandBot(A1,10,1); Color=IIf(a1<0 AND a1>Ref(a1,-1), colorLime,IIf(a1>0 AND a1>Ref(a1,-1),colorBrightGreen,IIf(a1>0 AND a1<Ref(a1,-1),colorPink,colorRed))); Plot(a1,"MACD",color,styleDots+styleLine); Plot(BBtop,"BBtop",colorDarkGreen,styleDashed); Plot(BBbot,"BBbot",colorDarkRed,styleDashed); Plot(0,"",31,1); P = ParamField("Price field",-1); Plot( EMA( P, 9 ), _DEFAULT_NAME(), colorBlue, styleThick ); Y0=LastValue( Trough((EMA(C,4)-EMA(C,34)),1,2)); y1=LastValue( Trough((EMA(C,4)-EMA(C,34)),1,1)); x0=BarCount - 1 - LastValue(TroughBars((EMA(C,4)-EMA(C,34)),1,2)); price_start= Close[x0] ; x1=BarCount - 1 - LastValue(TroughBars((EMA(C,4)-EMA(C,34)),1,1)); price_end=Close[ x1]; Line = LineArray( x0, y0, x1, y1, 0 ); Plot( Line, "Support line", colorWhite,styleThick ); Buy = y1>y0 AND price_end<price_start; y00=LastValue( Peak((EMA(C,4)-EMA(C,34)),1,2)); y11=LastValue( Peak((EMA(C,4)-EMA(C,34)),1,1)); x00=BarCount - 1 - LastValue(PeakBars((EMA(C,4)-EMA(C,34)),1,2)); price_start1= Close[x00] ; x11=BarCount - 1 - LastValue(PeakBars((EMA(C,4)-EMA(C,34)),1,1)); price_end1=Close[ x11]; Line = LineArray( x00, y00, x11, y11, 0 ); Plot( Line, "Resistance line", colorRed,styleThick ); _SECTION_END();