Nick MA Swing + Heikin Pivots
Nick MA Swing + Heikin Pivots AFL in Amibroker combines Nick MA Swing with Heikin Ashi pivots for trend identification. Integrated with Amibroker data feed, this AFL offers traders a comprehensive approach to analyze trends using multiple indicators. By utilizing Amibroker data feed capabilities, Nick MA Swing + Heikin Pivots assists traders in making informed decisions by amalgamating different indicators within the AFL.
/ _SECTION_BEGIN("NICK MA Swing + heikin pivots"); SetBarsRequired(200,0); GraphXSpace = 5; SetChartOptions(0,chartShowArrows|chartShowDates); k = Optimize("K",Param("K",1,0.25,5,0.25),0.25,5,0.25) ; Per= Optimize("atr",Param("atr",4,3,20,1),3,20,1); HACLOSE=(O+H+L+C)/4; HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); HaHigh = Max( H, Max( HaClose, HaOpen ) ); HaLow = Min( L, Min( HaClose, HaOpen ) ); PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel ); j=Haclose; //================================================== ================================================== =================== //=========================Indicator================ ================================================== ============================ f=ATR(14); rfsctor = WMA(H-L, Per); revers = k * rfsctor; Trend = 1; NW[0] = 0; for(i = 1; i < BarCount; i++) { if(Trend[i-1] == 1) { if(j[i] < NW[i-1]) { Trend[i] = -1; NW[i] = j[i] + Revers[i]; } else { Trend[i] = 1; if((j[i] - Revers[i]) > NW[i-1]) { NW[i] = j[i] - Revers[i]; } else { NW[i] = NW[i-1]; } } } if(Trend[i-1] == -1) { if(j[i] > NW[i-1]) { Trend[i] = 1; NW[i] = j[i] - Revers[i]; } else { Trend[i] = -1; if((j[i] + Revers[i]) < NW[i-1]) { NW[i] = j[i] + Revers[i]; } else { NW[i] = NW[i-1]; } } } } //===============system================ _SECTION_BEGIN("ema5,13sound"); x = EMA(Close,5); y = EMA(Close,13); Plot(EMA(Close,5),"",colorBrightGreen,styleLine, styleThick); Plot(EMA(Close,13),"",colorOrange,styleLine, styleThick); XR=(EMA(Close,5) * (2 / 6 - 1) - EMA(Close,13) * (2 / 11 - 1)) / (2 / 6 - 2 / 11); Buy=Cross(j,nw); Cover=Cross(j,nw); Sell=Cross(nw,j); Short=Cross(nw,j); SellPrice=ValueWhen(Sell,C,1); BuyPrice=ValueWhen(Buy,C,1); Long=Flip(Buy,Sell); Shrt=Flip(Sell,Buy ); _SECTION_END(); //=================TITLE============================ ================================================== ================== _SECTION_BEGIN("Title"); if( Status("action") == actionIndicator ) ( Title = EncodeColor(colorWhite)+ "NICK MA Swing System" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) + " - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+ "Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+ EncodeColor(colorRed)+ WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+ WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+ WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+ WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+ WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+ WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+ WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+ WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"","")); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-30); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-40); PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-35); PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40); PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50); PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45); PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-30); PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-40); PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-35); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50); PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45); AlertIf( Buy, "SOUND C:\\Windows\\Media\\Windows XP Startup.wav", "Audio alert", 2 ); AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ringin.wav", "Audio alert", 2 ); _SECTION_END();